etl/test/test_indirect_vector.cpp
John Wellbelove 2ea2e9a5d5 Squashed commit of the following:
commit 0bd0067022994f359c3bd68a7d34056f3a4de2f0
Merge: 3973ac2d 35cfa526
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 18:18:20 2020 +0100

    Merge branch 'feature/github-actions-for-windows-compilers' into development

    # Conflicts:
    #	.github/workflows/clang.yml
    #	CMakeLists.txt
    #	include/etl/version.h
    #	library.json
    #	library.properties
    #	support/Release notes.txt
    #	test/vs2019/etl.vcxproj
    #	test/vs2019/etl.vcxproj.filters

commit 35cfa5263d0bbc936ead29f69fa05f1c419311c3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 18:00:04 2020 +0100

    Add VS2019 configuration to Github CI

commit d894b9c422868400ac14cbb9a7b3ba12022e1021
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:56:13 2020 +0100

    Add VS2019 configuration to Github CI

commit c5f296bab9558c0655ebb84621eda0f4679da547
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:46:09 2020 +0100

    Add VS2019 configuration to Github CI

commit 2f1635f894cb82577603740eeb709979460b1cb7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:41:55 2020 +0100

    Add VS2019 configuration to Github CI

commit caabbba35746d7278bde9385c02de424a3bdb6e3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:41:01 2020 +0100

    Add VS2019 configuration to Github CI

commit 2df9504d74a6838a7294320c251f48501bcc9551
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:27:20 2020 +0100

    Add VS2019 configuration to Github CI

commit 70031f2d30cb8935e879340a047fa6ce4751b89d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 17:24:42 2020 +0100

    Add VS2019 configuration to Github CI

commit 534d5965076aced7b72c4301fd01f00df1825683
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 12:05:51 2020 +0100

    Add VS2019 configuration to Github CI

commit fbb7e467833e57054beb03e98bf8981eb9c81d5d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 11:35:17 2020 +0100

    Add VS2019 configuration to Github CI

commit 00d27fce28fd209550aa89e6a058959521abf341
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 11:09:37 2020 +0100

    Add VS2019 configuration to Github CI

commit 4b2662d33c47cb04793e1141778ba09230e26378
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 11:02:15 2020 +0100

    Add VS2019 configuration to Github CI

commit ce9526dcb915463f280c238f3c0e2ce3c48c4a4d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 10:51:23 2020 +0100

    Add VS2019 configuration to Github CI

commit e0edc9824d91763c29907ac555cfeffc5ab3fd62
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 10:29:41 2020 +0100

    Add VS2019 configuration to Github CI

commit 0f8b95c7b4fd81dc626f5436c7e6aa04612d4519
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 09:56:34 2020 +0100

    Add VS2019 configuration to Github CI

commit f4148c647b890cf53501f1923d5a4605372e66ee
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 09:49:55 2020 +0100

    Add VS2019 configuration to Github CI

commit 3973ac2dc354a3f4af2bc010fa5f7686f213f652
Author: Alastair Bain <45587683+thealastair@users.noreply.github.com>
Date:   Fri Oct 2 21:39:03 2020 +1300

    Fix missing empty define of ETL_OBJECT_RESET_DEBUG_COUNT (#280)

commit 7c07b112a019e25c284b39aeb168118830df6f77
Author: John Wellbelove <jwellbelove@users.noreply.github.com>
Date:   Wed Sep 30 11:35:57 2020 +0100

    Updated badges

commit 31e84421d86ad709651dd449d23910272a0b49db
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Fri Oct 2 09:40:02 2020 +0100

    Add VS2019 configuration to Github CI

commit 38d3cd35953c8d6e7057ecda431a68ee705a6587
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 19:42:57 2020 +0100

    Add VS2019 configuration to Github CI

commit c87fe057b3e374f8a3936b068d46ee6d6def002f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 19:36:28 2020 +0100

    Add VS2019 configuration to Github CI

commit 290f34535b639edc364821308f3d8388be85bb10
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 19:30:46 2020 +0100

    Add VS2019 configuration to Github CI

commit 5d15f8fb44be7ae37a1166aca12f27ea8dbbcef8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 18:27:00 2020 +0100

    Add VS2019 configuration to Github CI

commit eb1dd7e473ae25044d5642457424eca82b214aee
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 18:19:45 2020 +0100

    Add VS2019 configuration to Github CI

commit 2f7d60d9975a81feb2e0f2e7fa71946015e34ac0
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 18:17:16 2020 +0100

    Add VS2019 configuration to Github CI

commit 37c562538796cac192dc30e7d16839d7cc07711d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 18:07:40 2020 +0100

    Add VS2019 configuration to Github CI

commit ded6aed47387230296101569efb833240167c902
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 18:02:57 2020 +0100

    Add VS2019 configuration to Github CI

commit 24d7f467b84008da974f462c354913b9dc622d48
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:55:27 2020 +0100

    Add VS2019 configuration to Github CI

commit e35417871887a6fe9aeaaa59b01c27e4dfe12ef1
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:51:31 2020 +0100

    Add VS2019 configuration to Github CI

commit 9f2bfa17a6604bfecfcdd7fa1f418a2f474f07b7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:44:29 2020 +0100

    Add VS2019 configuration to Github CI

commit 29aa68326e6c354b978193044d71b6b68aca92fa
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:41:41 2020 +0100

    Add VS2019 configuration to Github CI

commit 56caea01bdf6b2ec3cd52c53b2e50d884ac563b4
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:37:05 2020 +0100

    Add VS2019 configuration to Github CI

commit 78c5a82ffc10a1e20b7a89d3276e077b3b0654c7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:32:06 2020 +0100

    Add VS2019 configuration to Github CI

commit a5b6dc79609c088fe5db4d31caf2480198586fdb
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:26:48 2020 +0100

    Add VS2019 configuration to Github CI

commit a36b45cdb375a61c17b5c9218ecd1b71689033a7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:22:58 2020 +0100

    Add VS2019 configuration to Github CI

commit 3bddc4ff1cfbf96a12fea4ff470964710f687673
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:21:36 2020 +0100

    Add VS2019 configuration to Github CI

commit 331513c3e09008976e1d86ccdb0a18301a4ed96c
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:19:46 2020 +0100

    Add VS2019 configuration to Github CI

commit 845d6902f119d978308408200edeec2b2dc3f9f3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:15:34 2020 +0100

    Add VS2019 configuration to Github CI

commit 811cbcfedf881a42af7f754a3b1256c3661f1636
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:13:13 2020 +0100

    Add VS2019 configuration to Github CI

commit 2a677f99aa99993264b471834ce705cc4e4ef3e5
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:06:40 2020 +0100

    Add VS2019 configuration to Github CI

commit 19fbfe774fd1761eb4a3e833697d3d13ed7c8c71
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:04:02 2020 +0100

    Add VS2019 configuration to Github CI

commit 8dc0db48f214a9a0bb6891a4abfdc1f47ed8a19f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:01:59 2020 +0100

    Add VS2019 configuration to Github CI

commit af226c09a09b7de850f4b0c0bec90ab4677dee49
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 17:00:19 2020 +0100

    Add VS2019 configuration to Github CI

commit e3f4d3536c853aa154c2f01e211f1adfa35d61d7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 16:57:13 2020 +0100

    Add VS2019 configuration to Github CI

commit 048c367ad072ab2a9f88324cff176813d6f68b83
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 16:53:21 2020 +0100

    Add VS2019 configuration to Github CI

commit 373c90c5532759a1fd81c8f5b8ff6e9b71157557
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 16:50:37 2020 +0100

    Add VS2019 configuration to Github CI

commit 362e5131f817273cfa2d688ec2d68a45fecb6775
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 16:49:22 2020 +0100

    Add VS2019 configuration to Github CI

commit 2a4756d6422eabfbcb1d0416b9352d9eb9bfbcbb
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:59:29 2020 +0100

    Add VS2019 configuration to Github CI

commit 45573dbd85d65cd5ce1e2907e010902c78e30d05
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:57:52 2020 +0100

    Add VS2019 configuration to Github CI

commit 17f2f66932440dc703ea206e348fb7787cf08265
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:56:18 2020 +0100

    Add VS2019 configuration to Github CI

commit bb9b00c8c9c1a99a404f3a512764602881e3ab57
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:55:11 2020 +0100

    Add VS2019 configuration to Github CI

commit c21cbbd8a94cec1672b1ff09c94b4716ac86c74c
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:39:40 2020 +0100

    Add VS2019 configuration to Github CI

commit be8679bb571db37062d166e04e79f16231820025
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 11:32:19 2020 +0100

    Add VS2019 configuration to Github CI

commit 5fdf89db4827f6fff74b8883aa0671a5aeb4a503
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:43:31 2020 +0100

    Add VS2019 configuration to Github CI

commit 7dc4d0ad941896eb5f2ca85758c0351673634c6d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:41:32 2020 +0100

    Add VS2019 configuration to Github CI

commit bc993027bf80fb23924d33ffddef92f2004e2a2d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:36:45 2020 +0100

    Add VS2019 configuration to Github CI

commit be2a660a62a485148d4d1a2b2dcdb12edc58860f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:25:25 2020 +0100

    Add VS2019 configuration to Github CI

commit 8e67b682452640fa7f6dbe968de06b4813b02bd8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:23:24 2020 +0100

    Add VS2019 configuration to Github CI

commit 6cb4d8829d96863e4992efb3cf4fa03acb31ec11
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:18:59 2020 +0100

    Add VS2019 configuration to Github CI

commit 646f95505ae4159a9f59edf9f42a8a67e4849a13
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:16:52 2020 +0100

    Add VS2019 configuration to Github CI

commit 2654f52cdd3b497e277d3ccf2ac7e242e899a7be
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:12:33 2020 +0100

    Add VS2019 configuration to Github CI

commit 698094c422b9f76697641e20782b82ab2d3d7891
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:11:07 2020 +0100

    Add VS2019 configuration to Github CI

commit 0b23e71578d402d49e3f31259dcd3d17b0ca6ac9
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 10:05:20 2020 +0100

    Add VS2019 configuration to Github CI

commit a08366166648d9411424493c89e06a55f844acb8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 09:57:29 2020 +0100

    Add VS2019 configuration to Github CI

commit 2bedbdf699e9d3bf990c3066425a88146c01cda3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Thu Oct 1 09:57:20 2020 +0100

    Add VS2019 configuration to Github CI

commit 6a1a2d56e576690ec5d439e6a5eb8f4f2292f69a
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:57:14 2020 +0100

    Add VS2019 configuration to Github CI

commit 1d993142542b20c85de8528c5a6e2fe6f84dd25c
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:50:10 2020 +0100

    Add VS2019 configuration to Github CI

commit 3f37897a4868d46b0f5469482bd5212967367184
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:48:07 2020 +0100

    Add VS2019 configuration to Github CI

commit fa3926bacf423407e4024461d24da739d28af3d9
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:47:26 2020 +0100

    Add VS2019 configuration to Github CI

commit 1cd30b7e8ed6e7d5dd6872e305cd3e286cb7cd79
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:45:58 2020 +0100

    Add VS2019 configuration to Github CI

commit db74e54c870d64c581061554350b3a6d29f543f3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:44:00 2020 +0100

    Add VS2019 configuration to Github CI

commit 78aa39ced507c275665b4ba05053b129c86339f6
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:43:27 2020 +0100

    Add VS2019 configuration to Github CI

commit a4154b27dd4381b1e2a542498b43be7f521aca52
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:27:35 2020 +0100

    Add VS2019 configuration to Github CI

commit cf4fe76427381232593e7e9ef1a497228d376aaf
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 19:18:05 2020 +0100

    Add VS2019 configuration to Github CI

commit 3819cf1bb7f062249c1550425a1c8e4639c9c5b7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 18:56:15 2020 +0100

    Add VS2019 configuration to Github CI

commit 9ce21707b4ad9612b9710c371d89b1096a73cbdc
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 11:31:21 2020 +0100

    Add VS2019 configuration to Github CI

commit c27f14479b246d68aa07f0513f9343206275e199
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 11:27:44 2020 +0100

    Add VS2019 configuration to Github CI

commit 1a90c1e3d171fbe438380dbb19586f92125e0f4b
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 11:12:02 2020 +0100

    Updates to CI configuration files to compile 'No STL' variants of the tests.

commit 7f256f6b94c97770aa64c5bfa2876e43b0a4ce11
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 10:49:53 2020 +0100

    Add No STL variants to Github CI

commit 22bbb8cb946afa523c7e676b8d071e62ff9ec427
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 10:09:48 2020 +0100

    CMakeLists test

commit a2ed867e371d1008e140807cee6321c4a03d7a47
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 09:55:20 2020 +0100

    CMakeLists test

commit 133c5fff77f9732bf9a4af790cfc8b77a98e6006
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 09:53:29 2020 +0100

    CMakeLists test

commit 3b4e92ce9a1822adb194e8de133bbf578a0d9113
Author: John Wellbelove <jwellbelove@users.noreply.github.com>
Date:   Wed Sep 30 10:36:54 2020 +0100

    Create FUNDING.yml

    Help keep the ETL active by supporting development

commit 22d38712c22e4e51fa1c89abe11a9c532fa160ed
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Sep 30 09:42:00 2020 +0100

    CMakeLists test

commit df23e2d750d7ec247001a29c53bbe19508c87bef
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 13:15:37 2020 +0100

    Conditionally disable template deduction guide tests

commit a5e02be012ac8122ac65ebb610da2f1a1bffd9c5
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 13:00:51 2020 +0100

    Conditionally disable template deduction guide tests

commit c2e185cf5680c8e64060845ced810520de13e7a0
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 12:51:23 2020 +0100

    Conditionally disable template deduction guide tests

commit 8296ec2b5c78283a5f3e4e75624505eacb3dc319
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 20:05:33 2020 +0100

    Add VS2019 configuration to Github CI

commit 5550500e7b7ebc6a9d450239ce5c1482a737b39f
Merge: b99b52c3 e337689e
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 19:56:03 2020 +0100

    Merge branch 'master' into feature/github-actions-for-windows-compilers

    # Conflicts:
    #	.github/workflows/main.yml
    #	include/etl/version.h
    #	library.json
    #	library.properties
    #	support/Release notes.txt
    #	test/vs2019/etl.vcxproj.filters

commit b99b52c39dcae34ae7ac5daaedd21b9b62bb2bd8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 19:52:00 2020 +0100

    Update main.yml

commit be5935787a934b8275e093344e4a3303f15d9468
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 12:49:22 2020 +0100

    Conditionally disable template deduction guide tests

commit 9e7cae7a02adf40379fa720979ff550d37a9643a
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 12:24:54 2020 +0100

    Conditionally disable template deduction guide tests

commit 713031a514b9781fc1bfa08ecfc62ed3b82e9388
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Sep 29 12:09:49 2020 +0100

    Conditionally disable template deduction guide tests

commit 67a67c18a32ef2b9ed2e4d2b1e894a0e88f7a6af
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Mon Aug 17 16:43:14 2020 +0100

    Github actions for MSVC

commit 063eae98782a51236294b96d05539ed5c23fe6ec
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Mon Aug 17 16:39:40 2020 +0100

    Github actions for MSVC

commit 609a7008d7e2400940dd99e89e07afc796b53a62
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Mon Aug 17 16:26:48 2020 +0100

    Github actions for MSVC

commit 6e649f98ba4a95713b0c0b09272ff2591dbcb0c5
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:55:16 2020 +0100

    Github actions for MSVC

commit 49735baa6d1940dd52d72b7f14333f364afa95a1
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:27:45 2020 +0100

    Github actions for MSVC

commit 347565bb802b416f15e7860592279a0c62be3610
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:24:40 2020 +0100

    Github actions for MSVC

commit 63e35414933b19d178b6729e9db737473d505956
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:18:43 2020 +0100

    Github actions for MSVC

commit 2c10a814e9a1838f11acbc3d6e026123a8a1375e
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:06:56 2020 +0100

    Github actions for MSVC

commit 99200936817d794172a02e832373f16094fae26e
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 19:03:05 2020 +0100

    Github actions for MSVC

commit d592d059139eb7818a8c975e9e0e84ff8f07cda8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 18:59:30 2020 +0100

    Github actions for MSVC

commit 32b003629cc6bfa08ad17561324f3df5bcb5cd27
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 18:54:11 2020 +0100

    Github actions for MSVC

commit 4b485bc038e1624023af604fa2403107dfbe877f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 15:45:58 2020 +0100

    Github actions for MSVC

commit 8e154a75ce86a4baa0e5c8497519f663c0eca66f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 15:33:56 2020 +0100

    Github actions for MSVC

commit cebf7ea072e4e101695d011afcf77ec21aacad81
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 15:12:30 2020 +0100

    Github actions for MSVC

commit 7dc4f772360cebb43df3901c0129007f8f17930a
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 14:41:42 2020 +0100

    Github actions for MSVC

commit 7d7dd89c703dcc6d23a8d0c83b727cc9df7b71f5
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sun Aug 16 11:32:23 2020 +0100

    Fixed issue for incorrect operation of erase(const_iterator, const_iterator)

    when the terminating iterator was end() for etl::unordered_map, etl::unordered_multimap, etl::unordered_set and etl::unordered_multiset.

commit bb52c37eca73b114820cb131641397ce9764b85b
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Sat Aug 15 21:00:18 2020 +0100

    Fixed issue for incorrect operation of erase(const_iterator, const_iterator)

    when the terminating iterator was end() for etl::unordered_map, etl::unordered_multimap, etl::unordered_set and etl::unordered_multiset.

commit dc501fa2c477ee37b79c4dbe6eca0ed92fa96115
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Aug 12 10:26:39 2020 +0100

    Github actions for MSVC

commit b8389c71348bee12c60d77f2b4c240670e931ea2
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Aug 12 10:23:56 2020 +0100

    Github actions for MSVC

commit 2ea9aece4fe9df2a80b9264d1aea2fc497467bdb
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Wed Aug 12 10:17:51 2020 +0100

    Github actions for MSVC

commit 8577e8e5f22ffe6c7dec111ed4383f16ad6b3d74
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 20:04:59 2020 +0100

    Github actions for MSVC

commit d6e3db0b9f2762318d4accb3f7b04bc8be0a16af
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 20:00:57 2020 +0100

    Github actions for MSVC

commit d2c5b761e53f62929ad179e79435c9c8eb30c1ba
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 19:49:41 2020 +0100

    Github actions for MSVC

commit 3ea20255e1bc77e77bf759008dc626c79f30415e
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 19:36:12 2020 +0100

    Github actions for MSVC

commit 1b396679ebcf7768f301c37dfe5baedb489fa5a8
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 19:31:55 2020 +0100

    Github actions for MSVC

commit db1a9790e0dfe0999cd9e3b222d32b3bbcb6ce7a
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 12:22:39 2020 +0100

    Github actions for MSVC

commit 662dd6ea24f2ca315668a362a6ff0b76f1d353ec
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 12:14:51 2020 +0100

    Github actions for MSVC

commit fdb0f64ec9f22caf398d128a81f97abcba7bd256
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 12:11:52 2020 +0100

    Github actions for MSVC

commit 35a2fc91aa142246c5d7d10970b0e8f326d4f681
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 12:06:40 2020 +0100

    Github actions for MSVC

commit 79f3148eb3c4b050da3e1d2bfc4b3c7b4dfc32f6
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 11:06:29 2020 +0100

    Github actions for MSVC

commit 208f0c2fb61b8a9b5d1bb214e9358d1bbacaac70
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:57:32 2020 +0100

    Github actions for MSVC

commit 5d9bbf2672e49d2b4729b80ee9c763aa7c730e00
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:52:09 2020 +0100

    Github actions for MSVC

commit 6a2ce5e8c44ad68a14eda365cfa75e46b24cf08c
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:49:24 2020 +0100

    Github actions for MSVC

commit c4f59bc20024120034212290488fa67e2035958a
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:38:44 2020 +0100

    Github actions for MSVC

commit 5cf076d61ed070dcf7bb03fc838c5d4cf9e96a24
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:35:19 2020 +0100

    Github actions for MSVC

commit 731167fff6854d849be770bb6e6b32d2f64bc256
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:32:20 2020 +0100

    Github actions for MSVC

commit e3d23f95bb85b5762c7f64c4c82d9ba698f6fdbc
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:30:13 2020 +0100

    Github actions for MSVC

commit d887d110357d2bfee6073c1a2c733c8493155791
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:27:40 2020 +0100

    Github actions for MSVC

commit 346abe9a691b5b64f96a5a6de7a60cc317c40380
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:21:39 2020 +0100

    Github actions for MSVC

commit 192a851577fa3320833f60afe3e8e4a0d2e82edb
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:18:38 2020 +0100

    Github actions for MSVC

commit c0590bf52d0c074c868123629e8156caf081ae5d
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:16:01 2020 +0100

    Github actions for MSVC

commit 9724a0fe3fd58978651ddd6276342559790ec6d7
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:07:52 2020 +0100

    Github actions for MSVC

commit a9d39153e57abf527f1a1105ae07e666c13bacfd
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:03:20 2020 +0100

    Github actions for MSVC

commit b971037ce5ae046778a98d8cdd3d51620b312644
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 10:02:06 2020 +0100

    Github actions for MSVC

commit 44e2730baa0cab5e2f365bc88347ce85f692e019
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 09:58:08 2020 +0100

    Github actions for MSVC

commit 1a3a2ce5cbe3095db2291b4193550ae2bfe684c3
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 09:54:08 2020 +0100

    Github actions for MSVC

commit 367f96552e14745bdb53999ea01729b9631f042f
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 09:53:29 2020 +0100

    Github actions for MSVC

commit f9dbaba07643f15ea89e34e813d10ece1a2584dc
Author: John Wellbelove <github@wellbelove.co.uk>
Date:   Tue Aug 11 09:52:12 2020 +0100

    Github actions for MSVC
2020-10-02 18:30:55 +01:00

1471 lines
49 KiB
C++

///******************************************************************************
//The MIT License(MIT)
//
//Embedded Template Library.
//https://github.com/ETLCPP/etl
//https://www.etlcpp.com
//
//Copyright(c) 2019 jwellbelove
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files(the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so, subject to the following conditions :
//
//The above copyright notice and this permission notice shall be included in all
//copies or substantial portions of the Software.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
//AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//SOFTWARE.
//******************************************************************************/
#include "UnitTest++/UnitTest++.h"
#include <vector>
#include <array>
#include <algorithm>
#include <memory>
#include "etl/indirect_vector.h"
#include "data.h"
namespace
{
SUITE(test_indirect_vector)
{
static const size_t SIZE = 12;
typedef TestDataNDC<std::string> NDC;
typedef TestDataDC<std::string> DC;
static NDC ndc("NDC");
typedef etl::indirect_vector<NDC, SIZE> DataNDC;
typedef etl::iindirect_vector<NDC> IDataNDC;
typedef std::vector<NDC> CompareDataNDC;
typedef etl::indirect_vector<DC, SIZE> DataDC;
typedef etl::iindirect_vector<DC> IDataDC;
typedef std::vector<DC> CompareDataDC;
CompareDataNDC initial_data;
CompareDataNDC less_data;
CompareDataNDC greater_data;
CompareDataNDC shorter_data;
CompareDataNDC different_data;
CompareDataNDC insert_data;
CompareDataNDC ordered_data;
CompareDataNDC part_ordered_data;
CompareDataNDC part_reverse_ordered_data;
CompareDataNDC stable_default_ordered_data;
CompareDataNDC stable_reverse_ordered_data;
CompareDataNDC stable_greater_ordered_data;
CompareDataNDC stable_greater_reverse_ordered_data;
CompareDataNDC unordered_data;
CompareDataNDC stable_part_ordered_data;
CompareDataNDC stable_part_greater_ordered_data;
template <typename TIterator, typename TFunctor>
void test_algorithm(TIterator first1, TIterator last1, TIterator first2, TFunctor functor)
{
while (first1 != last1)
{
functor(*first1++, *first2++);
}
}
//*************************************************************************
struct SetupFixture
{
SetupFixture()
{
NDC n[] = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4"), NDC("4"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_insert[] = { NDC("11"), NDC("12"), NDC("13") };
NDC n_less[] = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4"), NDC("4"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_greater[] = { NDC("0"), NDC("1"), NDC("2"), NDC("4"), NDC("4"), NDC("4"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_unordered[] = { NDC("1"), NDC("4", 1), NDC("7"), NDC("4", 2), NDC("2"), NDC("4", 3), NDC("3"), NDC("6"), NDC("9"), NDC("0"), NDC("8"), NDC("5") };
NDC n_ordered[] = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4"), NDC("4"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_stable_default_ordered[] = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4", 1), NDC("4", 2), NDC("4", 3), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_stable_reverse_ordered[] = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4", 3), NDC("4", 2), NDC("4", 1), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
NDC n_stable_greater_ordered[] = { NDC("9"), NDC("8"), NDC("7"), NDC("6"), NDC("5"), NDC("4", 1), NDC("4", 2), NDC("4", 3), NDC("3"), NDC("2"), NDC("1"), NDC("0") };
NDC n_stable_greater_reverse_ordered_data[] = { NDC("9"), NDC("8"), NDC("7"), NDC("6"), NDC("5"), NDC("4", 3), NDC("4", 2), NDC("4", 1), NDC("3"), NDC("2"), NDC("1"), NDC("0") };
NDC n_part_ordered[] = { NDC("1"), NDC("4", 1), NDC("0"), NDC("2"), NDC("3"), NDC("4"), NDC("4"), NDC("6"), NDC("7"), NDC("9"), NDC("8"), NDC("5") };
NDC n_part_reverse_ordered[] = { NDC("1"), NDC("4"), NDC("9"), NDC("7"), NDC("6"), NDC("4"), NDC("4"), NDC("3"), NDC("2"), NDC("0"), NDC("8"), NDC("5") };
NDC n_stable_part_ordered[] = { NDC("1"), NDC("4", 1), NDC("0"), NDC("2"), NDC("3"), NDC("4", 2), NDC("4", 3), NDC("6"), NDC("7"), NDC("9"), NDC("8"), NDC("5") };
NDC n_stable_part_greater_ordered[] = { NDC("1"), NDC("4", 1), NDC("9"), NDC("7"), NDC("6"), NDC("4", 2), NDC("4", 3), NDC("3"), NDC("2"), NDC("0"), NDC("8"), NDC("5") };
initial_data.assign(std::begin(n), std::end(n));
insert_data.assign(std::begin(n_insert), std::end(n_insert));
less_data.assign(std::begin(n_less), std::end(n_less));
greater_data.assign(std::begin(n_greater), std::end(n_greater));
shorter_data.assign(std::begin(n_greater), std::end(n_greater) - 1);
different_data.assign(initial_data.rbegin(), initial_data.rend());
ordered_data.assign(std::begin(n_ordered), std::end(n_ordered));
part_ordered_data.assign(std::begin(n_part_ordered), std::end(n_part_ordered));
part_reverse_ordered_data.assign(std::begin(n_part_reverse_ordered), std::end(n_part_reverse_ordered));
unordered_data.assign(std::begin(n_unordered), std::end(n_unordered));
stable_default_ordered_data.assign(std::begin(n_stable_default_ordered), std::end(n_stable_default_ordered));
stable_reverse_ordered_data.assign(std::begin(n_stable_reverse_ordered), std::end(n_stable_reverse_ordered));
stable_greater_ordered_data.assign(std::begin(n_stable_greater_ordered), std::end(n_stable_greater_ordered));
stable_greater_reverse_ordered_data.assign(std::begin(n_stable_greater_reverse_ordered_data), std::end(n_stable_greater_reverse_ordered_data));
stable_part_ordered_data.assign(std::begin(n_stable_part_ordered), std::end(n_stable_part_ordered));
stable_part_greater_ordered_data.assign(std::begin(n_stable_part_greater_ordered), std::end(n_stable_part_greater_ordered));
}
};
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_default_constructor)
{
DataDC data;
CHECK_EQUAL(data.size(), size_t(0));
CHECK(data.empty());
CHECK_EQUAL(data.capacity(), SIZE);
CHECK_EQUAL(data.max_size(), SIZE);
}
#if ETL_USING_STL && !defined(ETL_TEMPLATE_DEDUCTION_GUIDE_TESTS_DISABLED)
//*************************************************************************
TEST(test_cpp17_deduced_constructor)
{
etl::indirect_vector data{ NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
etl::indirect_vector<NDC, 10U> check = { NDC("0"), NDC("1"), NDC("2"), NDC("3"), NDC("4"), NDC("5"), NDC("6"), NDC("7"), NDC("8"), NDC("9") };
CHECK(!data.empty());
CHECK(data.full());
CHECK(data.begin() != data.end());
CHECK_EQUAL(10U, data.size());
CHECK_EQUAL(0U, data.available());
CHECK_EQUAL(10U, data.capacity());
CHECK_EQUAL(10U, data.max_size());
CHECK(data == check);
}
#endif
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_destruct_via_ivector)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
int current_count = NDC::get_instance_count();
DataNDC* p = new DataNDC(INITIAL_SIZE, INITIAL_VALUE);
delete p;
DataNDC* pdata = new DataNDC(INITIAL_SIZE, INITIAL_VALUE);
CHECK_EQUAL(int(current_count + INITIAL_SIZE), NDC::get_instance_count());
IDataNDC* pidata = pdata;
delete pidata;
CHECK_EQUAL(current_count, NDC::get_instance_count());
}
//*************************************************************************
TEST(test_iterator_comparison_empty)
{
DataDC data;
CHECK(data.begin() == data.end());
CHECK(data.cbegin() == data.cend());
CHECK(data.rbegin() == data.rend());
CHECK(data.crbegin() == data.crend());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_size)
{
const size_t INITIAL_SIZE = 5;
DataDC data(INITIAL_SIZE);
CHECK(data.size() == INITIAL_SIZE);
CHECK(!data.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_size_value)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
std::vector<NDC> compare_data(INITIAL_SIZE, INITIAL_VALUE);
DataNDC data(size_t(5), NDC("1"));
CHECK(data.size() == INITIAL_SIZE);
CHECK(!data.empty());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_size_excess)
{
CHECK_THROW(DataDC data(SIZE + 1), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_constructor_range)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
CHECK(data.size() == SIZE);
CHECK(!data.empty());
}
#if ETL_USING_STL
//*************************************************************************
TEST(test_constructor_initializer_list)
{
CompareDataNDC compare_data = { NDC("0"), NDC("1"), NDC("2"), NDC("3") };
DataNDC data = { NDC("0"), NDC("1"), NDC("2"), NDC("3") };
CHECK_EQUAL(compare_data.size(), data.size());
CHECK(std::equal(compare_data.begin(), compare_data.end(), data.begin()));
}
#endif
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_copy_constructor)
{
DataNDC data(initial_data.begin(), initial_data.end());
DataNDC data2(data);
CHECK(data2 == data);
data2[2] = NDC("X");
CHECK(data2 != data);
}
//*************************************************************************
TEST(test_move_constructor)
{
typedef etl::indirect_vector<std::unique_ptr<uint32_t>, SIZE> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
std::unique_ptr<uint32_t> p3(new uint32_t(3U));
std::unique_ptr<uint32_t> p4(new uint32_t(4U));
Data data1;
data1.push_back(std::move(p1));
data1.push_back(std::move(p2));
data1.push_back(std::move(p3));
data1.push_back(std::move(p4));
CHECK(!bool(p1));
CHECK(!bool(p2));
CHECK(!bool(p3));
CHECK(!bool(p4));
Data data2(std::move(data1));
CHECK_EQUAL(0U, data1.size());
CHECK_EQUAL(4U, data2.size());
CHECK_EQUAL(1U, *data2[0]);
CHECK_EQUAL(2U, *data2[1]);
CHECK_EQUAL(3U, *data2[2]);
CHECK_EQUAL(4U, *data2[3]);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment)
{
DataNDC data(initial_data.begin(), initial_data.end());
DataNDC other_data;
other_data = data;
bool is_equal = std::equal(data.begin(),
data.end(),
other_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST(test_move_assignment)
{
typedef etl::indirect_vector<std::unique_ptr<uint32_t>, SIZE> Data;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
std::unique_ptr<uint32_t> p3(new uint32_t(3U));
std::unique_ptr<uint32_t> p4(new uint32_t(4U));
Data data1;
data1.push_back(std::move(p1));
data1.push_back(std::move(p2));
data1.push_back(std::move(p3));
data1.push_back(std::move(p4));
CHECK(!bool(p1));
CHECK(!bool(p2));
CHECK(!bool(p3));
CHECK(!bool(p4));
Data data2;
data2 = std::move(data1);
CHECK_EQUAL(0U, data1.size());
CHECK_EQUAL(4U, data2.size());
CHECK_EQUAL(1U, *data2[0]);
CHECK_EQUAL(2U, *data2[1]);
CHECK_EQUAL(3U, *data2[2]);
CHECK_EQUAL(4U, *data2[3]);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assignment_iterface)
{
DataNDC data1(initial_data.begin(), initial_data.end());
DataNDC data2;
IDataNDC& idata1 = data1;
IDataNDC& idata2 = data2;
idata2 = idata1;
bool is_equal = std::equal(data1.begin(),
data1.end(),
data2.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST(test_move_assignment_interface)
{
typedef etl::indirect_vector<std::unique_ptr<uint32_t>, SIZE> Data;
typedef etl::iindirect_vector<std::unique_ptr<uint32_t>> IData;
std::unique_ptr<uint32_t> p1(new uint32_t(1U));
std::unique_ptr<uint32_t> p2(new uint32_t(2U));
std::unique_ptr<uint32_t> p3(new uint32_t(3U));
std::unique_ptr<uint32_t> p4(new uint32_t(4U));
Data data1;
data1.push_back(std::move(p1));
data1.push_back(std::move(p2));
data1.push_back(std::move(p3));
data1.push_back(std::move(p4));
Data data2;
IData& idata1 = data1;
IData& idata2 = data2;
idata2 = std::move(idata1);
CHECK_EQUAL(0U, data1.size());
CHECK_EQUAL(4U, data2.size());
CHECK_EQUAL(1U, *data2[0]);
CHECK_EQUAL(2U, *data2[1]);
CHECK_EQUAL(3U, *data2[2]);
CHECK_EQUAL(4U, *data2[3]);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_self_assignment)
{
DataNDC data(initial_data.begin(), initial_data.end());
DataNDC other_data(data);
other_data = other_data;
bool is_equal = std::equal(data.begin(),
data.end(),
other_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_begin)
{
DataDC data(10);
const DataDC constData(10);
CHECK_EQUAL(&data[0], &(*data.begin()));
CHECK_EQUAL(&constData[0], &(*constData.begin()));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_end)
{
DataDC data(10);
const DataDC constData(10);
CHECK_EQUAL(&data[10], &(*data.end()));
CHECK_EQUAL(&constData[10], &(constData.end()));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_up)
{
const size_t INITIAL_SIZE = 5;
const size_t NEW_SIZE = 8;
DataDC data(INITIAL_SIZE);
data.resize(NEW_SIZE);
CHECK_EQUAL(data.size(), NEW_SIZE);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_up_value)
{
const size_t INITIAL_SIZE = 5;
const size_t NEW_SIZE = 8;
const NDC INITIAL_VALUE("1");
DataNDC data(INITIAL_SIZE, INITIAL_VALUE);
data.resize(NEW_SIZE, INITIAL_VALUE);
std::vector<NDC> compare_data(NEW_SIZE, INITIAL_VALUE);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(), data.end(), compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_excess)
{
const size_t INITIAL_SIZE = 5;
const size_t NEW_SIZE = SIZE + 1;
DataDC data(INITIAL_SIZE);
CHECK_THROW(data.resize(NEW_SIZE), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_down)
{
const size_t INITIAL_SIZE = 5;
const size_t NEW_SIZE = 2;
DataDC data(INITIAL_SIZE);
data.resize(NEW_SIZE);
CHECK_EQUAL(data.size(), NEW_SIZE);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_resize_down_value)
{
const size_t INITIAL_SIZE = 5;
const size_t NEW_SIZE = 2;
const NDC INITIAL_VALUE("1");
DataNDC data(INITIAL_SIZE, INITIAL_VALUE);
data.resize(NEW_SIZE, INITIAL_VALUE);
CHECK_EQUAL(data.size(), NEW_SIZE);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_empty)
{
DataDC data;
data.resize(data.max_size());
CHECK(data.full());
CHECK(!data.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_full)
{
DataNDC data;
CHECK(!data.full());
CHECK(data.empty());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_index)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
for (size_t i = 0; i < data.size(); ++i)
{
CHECK_EQUAL(data[i], compare_data[i]);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_index_const)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(compare_data.begin(), compare_data.end());
for (size_t i = 0; i < data.size(); ++i)
{
CHECK_EQUAL(data[i], compare_data[i]);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_at)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
for (size_t i = 0; i < data.size(); ++i)
{
CHECK_EQUAL(data.at(i), compare_data.at(i));
}
CHECK_THROW(data.at(data.size()), etl::vector_out_of_bounds);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_at_const)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(initial_data.begin(), initial_data.end());
for (size_t i = 0; i < data.size(); ++i)
{
CHECK_EQUAL(data.at(i), compare_data.at(i));
}
CHECK_THROW(data.at(data.size()), etl::vector_out_of_bounds);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_front)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
CHECK(data.front() == compare_data.front());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_front_const)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(initial_data.begin(), initial_data.end());
CHECK(data.front() == compare_data.front());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_back)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
CHECK(data.back() == compare_data.back());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_back_const)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(initial_data.begin(), initial_data.end());
CHECK(data.back() == compare_data.back());
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assign_range)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data;
data.assign(compare_data.begin(), compare_data.end());
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assign_size_value)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
std::vector<NDC> compare_data(INITIAL_SIZE, INITIAL_VALUE);
DataNDC data;
data.assign(INITIAL_SIZE, INITIAL_VALUE);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_assign_size_value_excess)
{
const size_t INITIAL_SIZE = SIZE;
const size_t EXCESS_SIZE = SIZE + 1;
const NDC INITIAL_VALUE("1");
std::vector<NDC> compare_data(INITIAL_SIZE, INITIAL_VALUE);
DataNDC data;
CHECK_THROW(data.assign(EXCESS_SIZE, INITIAL_VALUE), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_push_back)
{
CompareDataNDC compare_data;
DataNDC data;
for (size_t i = 0; i < SIZE; ++i)
{
std::string value(" ");
value[0] = char('A' + i);
compare_data.push_back(NDC(value));
data.push_back(NDC(value));
}
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_push_back_excess)
{
DataNDC data;
for (size_t i = 0; i < SIZE; ++i)
{
std::string value(" ");
value[0] = char('A' + i);
data.push_back(NDC(value));
}
CHECK_THROW(data.push_back(NDC("Z")), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_emplace_back)
{
CompareDataNDC compare_data;
DataNDC data;
for (size_t i = 0; i < SIZE; ++i)
{
std::string value(" ");
value[0] = char('A' + i);
compare_data.emplace_back(value);
data.emplace_back(value);
}
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_push_back_unique_ptr)
{
etl::indirect_vector<std::unique_ptr<int>, SIZE> data;
std::unique_ptr<int> p1(new int(1));
std::unique_ptr<int> p2(new int(2));
std::unique_ptr<int> p3(new int(3));
std::unique_ptr<int> p4(new int(4));
data.push_back(std::move(p1));
data.push_back(std::move(p2));
data.push_back(std::move(p3));
data.push_back(std::move(p4));
CHECK(!bool(p1));
CHECK(!bool(p2));
CHECK(!bool(p3));
CHECK(!bool(p4));
CHECK_EQUAL(1, *data[0]);
CHECK_EQUAL(2, *data[1]);
CHECK_EQUAL(3, *data[2]);
CHECK_EQUAL(4, *data[3]);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_int)
{
etl::indirect_vector<int, SIZE> data;
int p1(1);
int p2(2);
int p3(3);
int p4(4);
data.insert(data.begin(), p1);
data.insert(data.begin(), p2);
data.insert(data.begin(), p3);
data.insert(data.begin(), p4);
CHECK_EQUAL(4, data[0]);
CHECK_EQUAL(3, data[1]);
CHECK_EQUAL(2, data[2]);
CHECK_EQUAL(1, data[3]);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_unique_ptr)
{
etl::indirect_vector<std::unique_ptr<int>, SIZE> data;
std::unique_ptr<int> p1(new int(1));
std::unique_ptr<int> p2(new int(2));
std::unique_ptr<int> p3(new int(3));
std::unique_ptr<int> p4(new int(4));
data.insert(data.begin(), std::move(p1));
data.insert(data.begin(), std::move(p2));
data.insert(data.begin(), std::move(p3));
data.insert(data.begin(), std::move(p4));
CHECK(!bool(p1));
CHECK(!bool(p2));
CHECK(!bool(p3));
CHECK(!bool(p4));
CHECK_EQUAL(1, *data[3]);
CHECK_EQUAL(4, *data[0]);
CHECK_EQUAL(3, *data[1]);
CHECK_EQUAL(2, *data[2]);
}
//*************************************************************************
// To test the CPP03 versions then ETL_TEST_VECTOR_CPP11 must be set to 0 in vector.h
TEST_FIXTURE(SetupFixture, test_emplace_back_multiple)
{
class Data
{
public:
std::string a;
size_t b;
double c;
const char *d;
Data(std::string w) : a(w), b(0), c(0.0), d(0){}
Data(std::string w, size_t x) : a(w), b(x), c(0.0), d(0){}
Data(std::string w, size_t x, double y) : a(w), b(x), c(y), d(0){}
Data(std::string w, size_t x, double y, const char *z) : a(w), b(x), c(y), d(z){}
bool operator == (const Data &other) const
{
return (a == other.a) && (b == other.b) && (c == other.c) && (d == other.d);
}
};
std::vector<Data> compare_data;
etl::indirect_vector<Data, SIZE * 4> data;
const char* p = (const char* )0x12345678;
std::string s;
for (size_t i = 0; i < SIZE; ++i)
{
s += "x";
// 4 arguments
compare_data.emplace_back(s, i, static_cast<double>(i) + 0.1234, p);
data.emplace_back(s, i, static_cast<double>(i) + 0.1234, p);
// 3 arguments
compare_data.emplace_back(s, i, static_cast<double>(i) + 0.1234);
data.emplace_back(s, i, static_cast<double>(i) + 0.1234);
// 2 arguments
compare_data.emplace_back(s, i);
data.emplace_back(s, i);
// 1 argument
compare_data.emplace_back(s);
data.emplace_back(s);
}
CHECK_EQUAL(compare_data.size(), data.size());
const bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
// The C++11 variadic version uses non-const rvalue references so has the ability
// to emplace non-const reference members, the pre-C++11 const reference overloads
// does not have the ability to pass const reference parameters to non-const
// constructor parameters (like the members in Data below)
// So this is only tested on C++11 onwards
TEST_FIXTURE(SetupFixture, test_emplace_back_non_const_references)
{
#if ETL_CPP11_SUPPORTED && ETL_NOT_USING_STLPORT && !defined(ETL_VECTOR_FORCE_CPP03)
class Data
{
public:
std::string &a;
size_t &b;
double &c;
const char *d;
Data(std::string &w, size_t &x, double &y, const char *z) : a(w), b(x), c(y), d(z){}
bool operator == (const Data &other) const
{
return (a == other.a) && (b == other.b) && (c == other.c) && (d == other.d);
}
};
std::vector<Data> compare_data;
etl::indirect_vector<Data, SIZE * 3> data;
std::string a = "test_test_test";
size_t b = 9999;
double c = 123.456;
const char *d = "abcdefghijklmnopqrstuvwxyz";
for (size_t i = 0; i < SIZE; ++i)
{
data.emplace_back(a, b, c, d);
compare_data.emplace_back(a, b, c, d);
}
CHECK_EQUAL(compare_data.size(), data.size());
const bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
#endif
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_pop_back)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
compare_data.pop_back();
compare_data.pop_back();
data.pop_back();
data.pop_back();
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_pop_back_exception)
{
DataDC data;
data.resize(2);
data.pop_back();
data.pop_back();
CHECK_THROW(data.pop_back(), etl::vector_empty);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_value)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset)
{
CompareDataNDC compare_data;
DataNDC data;
data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
compare_data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
data.insert(data.begin() + offset, INITIAL_VALUE);
compare_data.insert(compare_data.begin() + offset, INITIAL_VALUE);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_emplace_position_value)
{
const size_t INITIAL_SIZE = 5;
const std::string INITIAL_VALUE("1");
for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset)
{
CompareDataNDC compare_data;
DataNDC data;
data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
compare_data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
data.emplace(data.begin() + offset, INITIAL_VALUE);
compare_data.emplace(compare_data.begin() + offset, INITIAL_VALUE);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_value_excess)
{
const size_t INITIAL_SIZE = SIZE;
const NDC INITIAL_VALUE("1");
const NDC UNINITIALISED_VALUE("Z");
DataNDC data(INITIAL_SIZE, INITIAL_VALUE);
size_t offset = 2;
CHECK_THROW(data.insert(data.begin() + offset, INITIAL_VALUE), etl::vector_full);
offset = 0;
CHECK_THROW(data.insert(data.begin() + offset, INITIAL_VALUE), etl::vector_full);
offset = data.size();
CHECK_THROW(data.insert(data.begin() + offset, INITIAL_VALUE), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_n_value)
{
const size_t INITIAL_SIZE = 5;
const size_t INSERT_SIZE = 3;
const NDC INITIAL_VALUE("1");
for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset)
{
CompareDataNDC compare_data;
DataNDC data;
data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
compare_data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
data.insert(data.begin() + offset, INSERT_SIZE, INITIAL_VALUE);
compare_data.insert(compare_data.begin() + offset, INSERT_SIZE, INITIAL_VALUE);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_n_value_excess)
{
const size_t INITIAL_SIZE = SIZE;
const size_t INSERT_SIZE = 4;
const NDC INITIAL_VALUE("1");
DataNDC data(INITIAL_SIZE, INITIAL_VALUE);
size_t offset = 0;
CHECK_THROW(data.insert(data.begin() + offset, INSERT_SIZE, INITIAL_VALUE), etl::vector_full);
offset = 2;
CHECK_THROW(data.insert(data.begin() + offset, INSERT_SIZE, INITIAL_VALUE), etl::vector_full);
offset = 4;
CHECK_THROW(data.insert(data.begin() + offset, INSERT_SIZE, INITIAL_VALUE), etl::vector_full);
offset = data.size();
CHECK_THROW(data.insert(data.begin() + offset, INSERT_SIZE, INITIAL_VALUE), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_range)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
for (size_t offset = 0; offset <= INITIAL_SIZE; ++offset)
{
CompareDataNDC compare_data;
DataNDC data;
data.resize(SIZE, NDC("Z"));
data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
compare_data.assign(initial_data.begin(), initial_data.begin() + INITIAL_SIZE);
data.insert(data.begin() + offset, insert_data.begin(), insert_data.end());
compare_data.insert(compare_data.begin() + offset, insert_data.begin(), insert_data.end());
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_insert_position_range_excess)
{
const size_t INITIAL_SIZE = 5;
const NDC INITIAL_VALUE("1");
DataNDC data(INITIAL_SIZE, INITIAL_VALUE);
size_t offset = 0;
CHECK_THROW(data.insert(data.begin() + offset, initial_data.begin(), initial_data.end()), etl::vector_full);
offset = 2;
CHECK_THROW(data.insert(data.begin() + offset, initial_data.begin(), initial_data.end()), etl::vector_full);
offset = 4;
CHECK_THROW(data.insert(data.begin() + offset, initial_data.begin(), initial_data.end()), etl::vector_full);
offset = data.size();
CHECK_THROW(data.insert(data.begin() + offset, initial_data.begin(), initial_data.end()), etl::vector_full);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_erase_single)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
compare_data.erase(compare_data.begin() + 2);
data.erase(data.begin() + 2);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_erase_range)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(initial_data.begin(), initial_data.end());
compare_data.erase(compare_data.begin() + 2, compare_data.begin() + 4);
data.erase(data.begin() + 2, data.begin() + 4);
CHECK_EQUAL(compare_data.size(), data.size());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_clear)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
data.clear();
CHECK_EQUAL(data.size(), size_t(0));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_iterator)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
bool is_equal = std::equal(data.begin(),
data.end(),
compare_data.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_iterator)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
bool is_equal = std::equal(data.cbegin(),
data.cend(),
compare_data.cbegin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_reverse_iterator)
{
CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
DataNDC data(compare_data.begin(), compare_data.end());
bool is_equal = std::equal(data.rbegin(),
data.rend(),
compare_data.rbegin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_reverse_iterator)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(compare_data.begin(), compare_data.end());
bool is_equal = std::equal(data.crbegin(),
data.crend(),
compare_data.crbegin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_const_reverse_iterator2)
{
const CompareDataNDC compare_data(initial_data.begin(), initial_data.end());
const DataNDC data(compare_data.begin(), compare_data.end());
bool is_equal = std::equal(data.rbegin(),
data.rend(),
compare_data.rbegin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_equal)
{
const DataNDC initial1(initial_data.begin(), initial_data.end());
const DataNDC initial2(initial_data.begin(), initial_data.end());
CHECK(initial1 == initial2);
const DataNDC different(different_data.begin(), different_data.end());
CHECK(!(initial1 == different));
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK(!(shorter == initial1));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_not_equal)
{
const DataNDC initial1(initial_data.begin(), initial_data.end());
const DataNDC initial2(initial_data.begin(), initial_data.end());
CHECK(!(initial1 != initial2));
const DataNDC different(different_data.begin(), different_data.end());
CHECK(initial1 != different);
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK(shorter != initial1);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_less_than)
{
const DataNDC less(less_data.begin(), less_data.end());
const DataNDC initial(initial_data.begin(), initial_data.end());
CHECK((less < initial) == (less_data < initial_data));
const DataNDC greater(greater_data.begin(), greater_data.end());
CHECK((greater < initial) == (greater_data < initial_data));
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK((shorter < initial) == (shorter_data < initial_data));
CHECK((initial < shorter) == (initial_data < shorter_data));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_less_than_or_equal)
{
const DataNDC less(less_data.begin(), less_data.end());
const DataNDC initial(initial_data.begin(), initial_data.end());
CHECK((less <= initial) == (less_data <= initial_data));
const DataNDC greater(greater_data.begin(), greater_data.end());
CHECK((greater <= initial) == (greater_data <= initial_data));
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK((shorter <= initial) == (shorter_data <= initial_data));
CHECK((initial <= shorter) == (initial_data <= shorter_data));
const DataNDC initial2(initial_data.begin(), initial_data.end());
CHECK((initial <= initial2) == (initial_data <= initial_data));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_greater_than)
{
const DataNDC less(less_data.begin(), less_data.end());
const DataNDC initial(initial_data.begin(), initial_data.end());
CHECK((less > initial) == (less_data > initial_data));
const DataNDC greater(greater_data.begin(), greater_data.end());
CHECK((greater > initial) == (greater_data > initial_data));
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK((shorter > initial) == (shorter_data > initial_data));
CHECK((initial > shorter) == (initial_data > shorter_data));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_greater_than_or_equal)
{
const DataNDC less(less_data.begin(), less_data.end());
const DataNDC initial(initial_data.begin(), initial_data.end());
CHECK((less >= initial) == (less_data >= initial_data));
const DataNDC greater(greater_data.begin(), greater_data.end());
CHECK((greater >= initial) == (greater_data >= initial_data));
const DataNDC shorter(shorter_data.begin(), shorter_data.end());
CHECK((shorter >= initial) == (shorter_data >= initial_data));
CHECK((initial >= shorter) == (initial_data > shorter_data));
const DataNDC initial2(initial_data.begin(), initial_data.end());
CHECK((initial >= initial2) == (initial_data >= initial_data));
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_indirect_algorithm)
{
DataNDC data1(initial_data.begin(), initial_data.end());
DataNDC data2(initial_data.rbegin(), initial_data.rend());
std::reverse(data1.begin().indirection(), data1.end().indirection());
bool is_equal = std::equal(data1.begin(),
data1.end(),
data2.begin());
CHECK(is_equal);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_indirect_algorithm_void_unary_function)
{
struct functor
{
void operator()(const NDC& ndc)
{
result += ndc.value;
}
std::string result;
};
const DataNDC data(ordered_data.begin(), ordered_data.end());
typedef typename DataNDC::unary_function_adaptor<functor> wrapped_functor;
functor unwrapped;
wrapped_functor wrapped(unwrapped);
functor direct = std::for_each(data.begin(),
data.end(),
unwrapped);
functor indirect = std::for_each(data.begin().indirection(),
data.end().indirection(),
wrapped).unary_function;
CHECK_EQUAL(direct.result, indirect.result);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_indirect_algorithm_bool_unary_function)
{
struct functor
{
bool operator()(const NDC& ndc)
{
return ndc.value == "4";
}
std::string result;
};
DataNDC data1(unordered_data.begin(), unordered_data.end());
DataNDC data2(unordered_data.begin(), unordered_data.end());
typedef typename DataNDC::unary_function_adaptor<functor, bool> wrapped_functor;
functor unwrapped;
wrapped_functor wrapped(unwrapped);
typename DataNDC::iterator direct = std::partition(data1.begin(),
data1.end(),
unwrapped);
typename DataNDC::indirect_iterator indirect = std::partition(data2.begin().indirection(),
data2.end().indirection(),
wrapped);
bool is_equal = std::equal(data1.begin(),
data1.end(),
data2.begin());
CHECK(is_equal);
CHECK(*direct == **indirect);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_indirect_algorithm_void_binary_function)
{
struct functor
{
void operator()(const NDC& lhs, const NDC& rhs)
{
result += lhs.value;
result += rhs.value;
}
std::string result;
};
typedef typename DataNDC::binary_function_adaptor<functor> wrapped_functor;
functor unwrapped;
wrapped_functor wrapped(unwrapped);
const DataNDC data1(ordered_data.begin(), ordered_data.end());
const DataNDC data2(ordered_data.begin(), ordered_data.end());
DataNDC direct_data;
DataNDC indirect_data;
test_algorithm(data1.begin(),
data1.end(),
data2.begin(),
unwrapped);
test_algorithm(data1.begin().indirection(),
data1.end().indirection(),
data2.begin().indirection(),
wrapped);
CHECK_EQUAL(unwrapped.result, wrapped.binary_function.result);
}
//*************************************************************************
TEST_FIXTURE(SetupFixture, test_indirect_algorithm_bool_binary_function)
{
DataNDC data(unordered_data.begin(), unordered_data.end());
std::sort(data.begin().indirection(),
data.end().indirection(),
typename DataNDC::binary_function_adaptor<std::less<NDC>, bool>(std::less<NDC>()));
bool is_equal = std::equal(data.begin(),
data.end(),
ordered_data.begin());
CHECK(is_equal);
}
};
}