diff options
Diffstat (limited to 'third_party/immer/test/vector')
-rw-r--r-- | third_party/immer/test/vector/B3-BL0.cpp | 15 | ||||
-rw-r--r-- | third_party/immer/test/vector/B3-BL2.cpp | 15 | ||||
-rw-r--r-- | third_party/immer/test/vector/B3-BL3.cpp | 15 | ||||
-rw-r--r-- | third_party/immer/test/vector/B3-BL4.cpp | 15 | ||||
-rw-r--r-- | third_party/immer/test/vector/default.cpp | 12 | ||||
-rw-r--r-- | third_party/immer/test/vector/gc.cpp | 22 | ||||
-rw-r--r-- | third_party/immer/test/vector/generic.ipp | 488 | ||||
-rw-r--r-- | third_party/immer/test/vector/issue-16.cpp | 122 | ||||
-rw-r--r-- | third_party/immer/test/vector/issue-46.cpp | 39 | ||||
-rw-r--r-- | third_party/immer/test/vector/issue-74.cpp | 24 |
10 files changed, 0 insertions, 767 deletions
diff --git a/third_party/immer/test/vector/B3-BL0.cpp b/third_party/immer/test/vector/B3-BL0.cpp deleted file mode 100644 index c0ddd2d66545..000000000000 --- a/third_party/immer/test/vector/B3-BL0.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/vector.hpp> - -template <typename T> -using test_vector_t = immer::vector<T, immer::default_memory_policy, 3u, 0u>; - -#define VECTOR_T test_vector_t -#include "generic.ipp" diff --git a/third_party/immer/test/vector/B3-BL2.cpp b/third_party/immer/test/vector/B3-BL2.cpp deleted file mode 100644 index 15cfeb9e2f11..000000000000 --- a/third_party/immer/test/vector/B3-BL2.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/vector.hpp> - -template <typename T> -using test_vector_t = immer::vector<T, immer::default_memory_policy, 3u, 2u>; - -#define VECTOR_T test_vector_t -#include "generic.ipp" diff --git a/third_party/immer/test/vector/B3-BL3.cpp b/third_party/immer/test/vector/B3-BL3.cpp deleted file mode 100644 index 5901940eab23..000000000000 --- a/third_party/immer/test/vector/B3-BL3.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/vector.hpp> - -template <typename T> -using test_vector_t = immer::vector<T, immer::default_memory_policy, 3u, 3u>; - -#define VECTOR_T test_vector_t -#include "generic.ipp" diff --git a/third_party/immer/test/vector/B3-BL4.cpp b/third_party/immer/test/vector/B3-BL4.cpp deleted file mode 100644 index 5f3b8c17eec8..000000000000 --- a/third_party/immer/test/vector/B3-BL4.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/vector.hpp> - -template <typename T> -using test_vector_t = immer::vector<T, immer::default_memory_policy, 3u, 4u>; - -#define VECTOR_T test_vector_t -#include "generic.ipp" diff --git a/third_party/immer/test/vector/default.cpp b/third_party/immer/test/vector/default.cpp deleted file mode 100644 index 1a1459ca124e..000000000000 --- a/third_party/immer/test/vector/default.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/vector.hpp> - -#define VECTOR_T ::immer::vector -#include "generic.ipp" diff --git a/third_party/immer/test/vector/gc.cpp b/third_party/immer/test/vector/gc.cpp deleted file mode 100644 index ec006adfb748..000000000000 --- a/third_party/immer/test/vector/gc.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include <immer/heap/gc_heap.hpp> -#include <immer/refcount/no_refcount_policy.hpp> -#include <immer/vector.hpp> - -using gc_memory = immer::memory_policy<immer::heap_policy<immer::gc_heap>, - immer::no_refcount_policy, - immer::gc_transience_policy, - false>; - -template <typename T> -using test_vector_t = immer::vector<T, gc_memory, 3u>; - -#define VECTOR_T test_vector_t -#include "generic.ipp" diff --git a/third_party/immer/test/vector/generic.ipp b/third_party/immer/test/vector/generic.ipp deleted file mode 100644 index ff277edbdb45..000000000000 --- a/third_party/immer/test/vector/generic.ipp +++ /dev/null @@ -1,488 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -#include "test/dada.hpp" -#include "test/util.hpp" - -#include <immer/algorithm.hpp> - -#include <boost/range/adaptors.hpp> -#include <catch.hpp> - -#include <algorithm> -#include <numeric> -#include <string> -#include <vector> - -using namespace std::string_literals; - -#ifndef VECTOR_T -#error "define the vector template to use in VECTOR_T" -#endif - -template <typename V = VECTOR_T<unsigned>> -auto make_test_vector(unsigned min, unsigned max) -{ - auto v = V{}; - for (auto i = min; i < max; ++i) - v = v.push_back({i}); - return v; -} - -struct big_object -{ - std::array<std::size_t, 42> v; -}; - -struct string_sentinel -{}; - -bool operator==(const char16_t* i, string_sentinel) { return *i == '\0'; } - -bool operator!=(const char16_t* i, string_sentinel) { return *i != '\0'; } - -TEST_CASE("instantiation") -{ - SECTION("default") - { - auto v = VECTOR_T<int>{}; - CHECK(v.size() == 0u); - CHECK(v.empty()); - } - - SECTION("initializer list") - { - auto v = VECTOR_T<unsigned>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - CHECK_VECTOR_EQUALS(v, boost::irange(0u, 10u)); - CHECK(!v.empty()); - } - - SECTION("big object") - { - auto v = VECTOR_T<big_object>{{}, {}, {}, {}}; - CHECK(v.size() == 4); - } - - SECTION("range") - { - auto r = std::vector<int>{{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}}; - auto v = VECTOR_T<unsigned>{r.begin(), r.end()}; - CHECK_VECTOR_EQUALS(v, boost::irange(0u, 10u)); - } - - SECTION("empty range") - { - auto r = std::vector<int>{}; - auto v = VECTOR_T<unsigned>{r.begin(), r.end()}; - CHECK(v.size() == 0); - } - - SECTION("iterator/sentinel") - { - auto r = u"012345678"; - string_sentinel s; - auto v = VECTOR_T<unsigned>{r, s}; - CHECK_VECTOR_EQUALS(v, boost::irange(u'0', u'9')); - } - - SECTION("fill") - { - auto v1 = VECTOR_T<int>(4); - CHECK(v1.size() == 4); - auto v2 = VECTOR_T<int>(4, 42); - CHECK(v2.size() == 4); - CHECK(v2[2] == 42); - } -} - -TEST_CASE("back and front") -{ - auto v = VECTOR_T<unsigned>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - CHECK(v.front() == 0); - CHECK(v.back() == 9); -} - -TEST_CASE("at") -{ - auto v = VECTOR_T<unsigned>{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; - CHECK(v.at(0) == 0); - CHECK(v.at(5) == 5); - CHECK_THROWS_AS(v.at(10), const std::out_of_range&); - CHECK_THROWS_AS(v.at(11), const std::out_of_range&); -} - -TEST_CASE("push back one element") -{ - SECTION("one element") - { - const auto v1 = VECTOR_T<int>{}; - auto v2 = v1.push_back(42); - CHECK(v1.size() == 0u); - CHECK(v2.size() == 1u); - CHECK(v2[0] == 42); - } - - SECTION("many elements") - { - const auto n = 666u; - auto v = VECTOR_T<unsigned>{}; - for (auto i = 0u; i < n; ++i) { - v = v.push_back(i * 42); - CHECK(v.size() == i + 1); - for (decltype(v.size()) j = 0; j < v.size(); ++j) - CHECK(v[j] == j * 42); - } - } -} - -TEST_CASE("update") -{ - const auto n = 42u; - auto v = make_test_vector(0, n); - - SECTION("set") - { - const auto u = v.set(3u, 13u); - CHECK(u.size() == v.size()); - CHECK(u[2u] == 2u); - CHECK(u[3u] == 13u); - CHECK(u[4u] == 4u); - CHECK(u[40u] == 40u); - CHECK(v[3u] == 3u); - } - - SECTION("set further") - { - auto v = make_test_vector(0, 666); - - auto u = v.set(3u, 13u); - u = u.set(200u, 7u); - CHECK(u.size() == v.size()); - - CHECK(u[2u] == 2u); - CHECK(u[4u] == 4u); - CHECK(u[40u] == 40u); - CHECK(u[600u] == 600u); - - CHECK(u[3u] == 13u); - CHECK(u[200u] == 7u); - - CHECK(v[3u] == 3u); - CHECK(v[200u] == 200u); - } - - SECTION("set further more") - { - auto v = make_test_vector(0, 666u); - - for (decltype(v.size()) i = 0; i < v.size(); ++i) { - v = v.set(i, i + 1); - CHECK(v[i] == i + 1); - } - } - - SECTION("update") - { - const auto u = v.update(10u, [](auto x) { return x + 10; }); - CHECK(u.size() == v.size()); - CHECK(u[10u] == 20u); - CHECK(v[40u] == 40u); - - const auto w = v.update(40u, [](auto x) { return x - 10; }); - CHECK(w.size() == v.size()); - CHECK(w[40u] == 30u); - CHECK(v[40u] == 40u); - } -} - -TEST_CASE("iterator") -{ - const auto n = 666u; - auto v = make_test_vector(0, n); - - SECTION("empty vector") - { - auto v = VECTOR_T<unsigned>{}; - CHECK(v.begin() == v.end()); - } - - SECTION("works with range loop") - { - auto i = 0u; - for (const auto& x : v) - CHECK(x == i++); - CHECK(i == v.size()); - } - - SECTION("works with standard algorithms") - { - auto s = std::vector<unsigned>(n); - std::iota(s.begin(), s.end(), 0u); - std::equal(v.begin(), v.end(), s.begin(), s.end()); - } - - SECTION("can go back from end") - { - auto expected = n - 1; - auto last = v.end(); - CHECK(expected == *--last); - } - - SECTION("works with reversed range adaptor") - { - auto r = v | boost::adaptors::reversed; - auto i = n; - for (const auto& x : r) - CHECK(x == --i); - } - - SECTION("works with strided range adaptor") - { - auto r = v | boost::adaptors::strided(5); - auto i = 0u; - for (const auto& x : r) - CHECK(x == 5 * i++); - } - - SECTION("works reversed") - { - auto i = n; - for (auto iter = v.rbegin(), last = v.rend(); iter != last; ++iter) - CHECK(*iter == --i); - } - - SECTION("advance and distance") - { - auto i1 = v.begin(); - auto i2 = i1 + 100; - CHECK(100u == *i2); - CHECK(100 == i2 - i1); - CHECK(50u == *(i2 - 50)); - CHECK(-30 == (i2 - 30) - i2); - } -} - -TEST_CASE("equals") -{ - const auto n = 666u; - auto v = make_test_vector(0, n); - - CHECK(v == v); - CHECK(v == v.set(42, 42)); - CHECK(v != v.set(42, 24)); - CHECK(v == v.set(42, 24).set(42, 42)); - CHECK(v.set(42, 24) == v.set(42, 24)); - CHECK(v != v.push_back(7)); - CHECK(v.push_back(7) == v.push_back(7)); - CHECK(v.push_back(5) != v.push_back(7)); - CHECK(v != v.set(v.size() - 2, 24)); - CHECK(v == v.set(v.size() - 2, 24).set(v.size() - 2, v[v.size() - 2])); -} - -TEST_CASE("all of") -{ - const auto n = 666u; - auto v = make_test_vector(0, n); - - SECTION("false") - { - auto res = immer::all_of(v, [](auto x) { return x < 100; }); - CHECK(res == false); - } - SECTION("true") - { - auto res = immer::all_of(v, [](auto x) { return x < 1000; }); - CHECK(res == true); - } - SECTION("bounded, true") - { - auto res = immer::all_of( - v.begin() + 101, v.end() - 10, [](auto x) { return x > 100; }); - CHECK(res == true); - } - SECTION("bounded, false") - { - auto res = immer::all_of( - v.begin() + 101, v.end() - 10, [](auto x) { return x < 600; }); - CHECK(res == false); - } -} - -TEST_CASE("accumulate") -{ - const auto n = 666u; - auto v = make_test_vector(0, n); - - auto expected_n = [](auto n) { return n * (n - 1) / 2; }; - auto expected_i = [&](auto i, auto n) { - return expected_n(n) - expected_n(i); - }; - - SECTION("sum collection") - { - auto sum = immer::accumulate(v, 0u); - CHECK(sum == expected_n(v.size())); - } - - SECTION("sum range") - { - using namespace std; - { - auto sum = immer::accumulate(begin(v) + 100, begin(v) + 300, 0u); - CHECK(sum == expected_i(100, 300)); - } - { - auto sum = immer::accumulate(begin(v) + 31, begin(v) + 300, 0u); - CHECK(sum == expected_i(31, 300)); - } - { - auto sum = immer::accumulate(begin(v), begin(v) + 33, 0u); - CHECK(sum == expected_i(0, 33)); - } - { - auto sum = immer::accumulate(begin(v) + 100, begin(v) + 660, 0u); - CHECK(sum == expected_i(100, 660)); - } - { - auto sum = immer::accumulate(begin(v) + 100, begin(v) + 105, 0u); - CHECK(sum == expected_i(100, 105)); - } - { - auto sum = immer::accumulate(begin(v) + 660, begin(v) + 664, 0u); - CHECK(sum == expected_i(660, 664)); - } - } -} - -TEST_CASE("vector of strings") -{ - const auto n = 666u; - - auto v = VECTOR_T<std::string>{}; - for (auto i = 0u; i < n; ++i) - v = v.push_back(std::to_string(i)); - - for (decltype(v.size()) i = 0; i < v.size(); ++i) - CHECK(v[i] == std::to_string(i)); - - SECTION("set") - { - for (auto i = 0u; i < n; ++i) - v = v.set(i, "foo " + std::to_string(i)); - for (auto i = 0u; i < n; ++i) - CHECK(v[i] == "foo " + std::to_string(i)); - } -} - -struct non_default -{ - unsigned value; - non_default() = delete; - operator unsigned() const { return value; } - -#if IMMER_DEBUG_PRINT - friend std::ostream& operator<<(std::ostream& os, non_default x) - { - os << "ND{" << x.value << "}"; - return os; - } -#endif -}; - -TEST_CASE("non default") -{ - const auto n = 666u; - - auto v = VECTOR_T<non_default>{}; - for (auto i = 0u; i < n; ++i) - v = v.push_back({i}); - - CHECK_VECTOR_EQUALS(v, boost::irange(0u, n)); - - SECTION("set") - { - for (auto i = 0u; i < n; ++i) - v = v.set(i, {i + 1}); - - CHECK_VECTOR_EQUALS(v, boost::irange(1u, n + 1u)); - } -} - -TEST_CASE("take") -{ - const auto n = 666u; - - SECTION("anywhere") - { - auto v = make_test_vector(0, n); - - for (auto i : test_irange(0u, n)) { - auto vv = v.take(i); - CHECK(vv.size() == i); - CHECK_VECTOR_EQUALS_RANGE(vv, v.begin(), v.begin() + i); - } - } -} - -TEST_CASE("exception safety") -{ - constexpr auto n = 666u; - - using dadaist_vector_t = typename dadaist_wrapper<VECTOR_T<unsigned>>::type; - - SECTION("push back") - { - auto v = dadaist_vector_t{}; - auto d = dadaism{}; - for (auto i = 0u; v.size() < static_cast<decltype(v.size())>(n);) { - auto s = d.next(); - try { - v = v.push_back({i}); - ++i; - } catch (dada_error) {} - CHECK_VECTOR_EQUALS(v, boost::irange(0u, i)); - } - CHECK(d.happenings > 0); - IMMER_TRACE_E(d.happenings); - } - - SECTION("update") - { - auto v = make_test_vector<dadaist_vector_t>(0, n); - auto d = dadaism{}; - for (auto i = 0u; i < n;) { - auto s = d.next(); - try { - v = v.update(i, [](auto x) { return dada(), x + 1; }); - ++i; - } catch (dada_error) {} - CHECK_VECTOR_EQUALS( - v, boost::join(boost::irange(1u, 1u + i), boost::irange(i, n))); - } - CHECK(d.happenings > 0); - IMMER_TRACE_E(d.happenings); - } - - SECTION("take") - { - auto v = make_test_vector<dadaist_vector_t>(0, n); - auto d = dadaism{}; - for (auto i = 0u; i < n;) { - auto s = d.next(); - auto r = dadaist_vector_t{}; - try { - r = v.take(i); - CHECK_VECTOR_EQUALS(r, boost::irange(0u, i++)); - } catch (dada_error) { - CHECK_VECTOR_EQUALS(r, boost::irange(0u, 0u)); - } - } - CHECK(d.happenings > 0); - IMMER_TRACE_E(d.happenings); - } -} diff --git a/third_party/immer/test/vector/issue-16.cpp b/third_party/immer/test/vector/issue-16.cpp deleted file mode 100644 index 81156b240bda..000000000000 --- a/third_party/immer/test/vector/issue-16.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -// Thanks Dominic Chen <ddchen@cs.cmu.edu> for reporting this issue -// https://github.com/arximboldi/immer/issues/16 - -#include <immer/flex_vector.hpp> -#include <immer/flex_vector_transient.hpp> -#include <immer/heap/gc_heap.hpp> -#include <vector> - -std::vector<unsigned> init = { - 291, 438, 755, 608, 594, 912, 73, 97, 496, 101, 837, 696, 978, - 948, 126, 131, 624, 26, 590, 201, 219, 339, 193, 218, 866, 407, - 538, 780, 312, 909, 129, 883, 571, 865, 854, 372, 488, 695, 750, - 341, 798, 375, 350, 1013, 361, 1012, 743, 425, 68, 280, 245, 149, - 342, 535, 901, 223, 285, 928, 666, 534, 166, 963, 171, 893, 297, - 1017, 549, 172, 505, 965, 831, 563, 79, 180, 147, 543, 639, 1022, - 880, 559, 426, 27, 657, 33, 252, 758, 8, 641, 699, 399, 335, - 473, 625, 703, 264, 796, 61, 737, 527, 795, 123, 200, 287, 857, - 208, 897, 354, 885, 581, 57, 752, 855, 56, 1007, 357, 643, 476, - 113, 955, 349, 299, 76, 393, 557, 967, 995, 233, 990, 469, 742, - 681, 874, 673, 530, 835, 24, 178, 81, 69, 40, 368, 981, 941, - 645, 808, 511, 982, 888, 136, 100, 960, 804, 806, 600, 500, 337, - 580, 551, 593, 612, 318, 660, 232, 17, 879, 86, 424, 202, 112, - 235, 791, 873, 838, 47, 574, 858, 78, 237, 846, 340, 802, 907, - 72, 38, 44, 902, 595, 940, 182, 784, 207, 355, 815, 545, 555, - 258, 144, 564, 463, 198, 1004, 4, 175, 468, 658, 59, 938, 63, - 20, 179, 714, 721, 723, 381, 3, 745, 415, 119, 413, 923, 157, - 824, 668, 409, 459, 560, 353, 379, 450, 430, 479, 274, 309, 661, - 508, 474, 771, 504, 674, 51, 173, 670, 83, 921, 1019, 956, 725, - 556, 427, 597, 794, 918, 95, 514, 98, 638, 205, 727, 162, 905, - 728, 431, 203, 828, 971, 648, 871, 215, 646, 1006, 816, 277, 861, - 576, 99, 637, 67, 28, 161, 137, 14, 506, 717, 93, 298, 251, - 975, 927, 818, 43, 284, 994, 196, 195, 260, 705, 604, 169, 296, - 785, 911, 398, 687, 760, 486, 642, 417, 445, 925, 763, 756, 653, - 662, 359, 84, 151, 980, 914, 440, 546, 329, 665, 435, 732, 922, - 377, 105, 532, 282, 822, 878, 419, 659, 65, 111, 421, 672, 146, - 320, 316, 31, 522, 145, 513, 373, 773, 184, 974, 621, 366, 124, - 623, 953, 267, 712, 121, 512, 214, 1002, 455, 694, 834, 618, 324, - 656, 257, 206, 554, 334, 606, 305, 1008, 190, 160, 502, 1024, 891, - 751, 789, 821, 462, 489, 908, 370, 164, 746, 270, 319, 491, 443, - 531, 775, 977, 244, 485, 840, 892, 850, 347, 729, 317, 74, 731, - 738, 790, 988, 903, 176, 211, 890, 509, 592, 444, 307, 45, 810, - 390, 239, 678, 999, 414, 693, 345, 363, 382, 602, 516, 801, 310, - 754, 774, 364, 480, 290, 322, 887, 168, 37, 140, 937, 578, 1005, - 614, 734, 449, 230, 541, 761, 931, 882, 920, 210, 807, 115, 964, - 521, 862, 628, 747, 490, 422, 788, 691, 675, 652, 25, 582, 585, - 961, 472, 722, 7, 367, 15, 275, 700, 249, 116, 969, 325, 706, - 493, 524, 537, 875, 22, 688, 843, 575, 288, 141, 830, 698, 562, - 833, 143, 117, 683, 1000, 238, 397, 827, 619, 686, 1018, 973, 80, - 689, 165, 702, 88, 332, 192, 730, 847, 408, 58, 634, 471, 958, - 204, 236, 314, 494, 158, 412, 226, 135, 103, 998, 85, 904, 587, - 194, 6, 380, 987, 266, 853, 369, 949, 34, 799, 884, 16, 944, - 701, 313, 300, 611, 148, 457, 216, 900, 10, 715, 586, 561, 917, - 1020, 800, 640, 104, 864, 185, 566, 492, 709, 1009, 498, 859, 945, - 710, 433, 819, 411, 418, 649, 876, 733, 286, 326, 599, 986, 465, - 929, 272, 916, 935, 1, 87, 650, 609, 344, 598, 951, 221, 242, - 352, 635, 680, 464, 75, 256, 962, 336, 82, 383, 836, 993, 222, - 446, 110, 970, 591, 439, 677, 308, 186, 664, 188, 253, 770, 5, - 651, 467, 684, 139, 762, 315, 89, 507, 477, 406, 358, 753, 877, - 442, 32, 2, 997, 120, 946, 391, 220, 996, 125, 943, 749, 130, - 553, 385, 692, 814, 615, 396, 388, 610, 630, 957, 371, 741, 268, - 199, 740, 823, 588, 250, 269, 577, 254, 845, 825, 153, 62, 303, - 842, 453, 241, 114, 483, 868, 550, 952, 429, 434, 529, 503, 333, - 616, 913, 23, 872, 679, 497, 9, 841, 772, 150, 776, 52, 947, - 805, 613, 620, 343, 895, 812, 782, 138, 281, 778, 829, 289, 820, - 106, 400, 484, 402, 915, 720, 122, 724, 783, 436, 499, 605, 627, - 191, 607, 536, 91, 461, 108, 976, 851, 46, 676, 765, 109, 96, - 437, 323, 261, 330, 273, 311, 271, 972, 719, 306, 889, 707, 384, - 764, 979, 572, 475, 231, 519, 682, 832, 448, 356, 966, 1010, 404, - 757, 209, 548, 617, 228, 482, 156, 596, 1014, 405, 187, 860, 420, - 655, 276, 797, 243, 1003, 229, 950, 869, 163, 321, 848, 395, 302, - 803, 711, 515, 376, 886, 278, 128, 870, 1015, 989, 636, 1023, 573, - 704, 984, 601, 932, 18, 386, 926, 632, 647, 579, 365, 669, 910, - 768, 809, 526, 769, 66, 432, 213, 293, 48, 839, 217, 224, 813, - 899, 328, 177, 654, 401, 544, 154, 118, 736, 766, 495, 936, 767, - 523, 569, 458, 460, 685, 107, 718, 631, 844, 248, 933, 60, 227, - 374, 246, 247, 331, 894, 183, 279, 338, 387, 633, 565, 403, 744, - 849, 41, 942, 517, 389, 518, 133, 622, 35, 779, 362, 726, 1021, - 189, 787, 71, 539, 262, 423, 346, 856, 212, 748, 64, 930, 667, - 881, 781, 603, 817, 410, 378, 170, 225, 558, 29, 906, 174, 939, - 21, 292, 304, 663, 240, 793, 567, 456, 255, 811, 954, 735, 867, - 428, 991, 152, 528, 70, 263, 392, 697, 671, 155, 49, 301, 792, - 525, 959, 1001, 90, 924, 896, 826, 452, 968, 11, 542, 53, 327, - 777, 294, 94, 589, 547, 584, 416, 351, 713, 478, 55, 451, 36, - 708, 501, 132, 863, 54, 19, 142, 13, 934, 134, 30, 466, 716, - 295, 92, 447, 102, 181, 520, 644, 481, 470, 540, 583, 552, 786, - 690, 487, 394, 983, 259, 510, 50, 568, 533, 759, 992, 283, 39, - 360, 919, 167, 852, 42, 629, 1016, 454, 441, 1011, 0, 77, 197, - 234, 127, 159, 12, 898, 348, 265, 626, 739, 985}; - -using gc_policy = immer::memory_policy<immer::heap_policy<immer::gc_heap>, - immer::no_refcount_policy, - immer::gc_transience_policy, - false>; - -using immvec = immer::flex_vector_transient<unsigned, gc_policy>; - -void erase(immvec& v, unsigned idx) -{ - auto v2(v); - v.take(idx); - v2.drop(idx + 1); - v.append(v2); -} - -int main(int argc, char** argv) -{ - immvec vector; - for (auto i : init) - vector.push_back(i); - - erase(vector, 470); - vector.push_back(224); - erase(vector, 958); -} diff --git a/third_party/immer/test/vector/issue-46.cpp b/third_party/immer/test/vector/issue-46.cpp deleted file mode 100644 index 6475be210d05..000000000000 --- a/third_party/immer/test/vector/issue-46.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// immer: immutable data structures for C++ -// Copyright (C) 2016, 2017, 2018 Juan Pedro Bolivar Puente -// -// This software is distributed under the Boost Software License, Version 1.0. -// See accompanying file LICENSE or copy at http://boost.org/LICENSE_1_0.txt -// - -// Thanks Guiguiprim for reporting this issue -// https://github.com/arximboldi/immer/issues/46 - -#include <immer/flex_vector.hpp> -#include <immer/vector.hpp> -#include <immer/vector_transient.hpp> - -#include <catch.hpp> - -TEST_CASE("operator==() may return bad result") -{ - using bool_vec = immer::flex_vector<bool>; - - immer::vector<bool_vec> v0; - auto tv = v0.transient(); - tv.push_back(bool_vec(9, false)); - tv.push_back(bool_vec(10, false)); - tv.push_back(bool_vec(8, false)); - tv.push_back(bool_vec(6, false)); - tv.push_back(bool_vec(9, false)); - tv.push_back(bool_vec(7, false)); - tv.push_back(bool_vec(8, false)); - tv.push_back(bool_vec(9, false)); - tv.push_back(bool_vec(10, false)); - v0 = tv.persistent(); - - auto v1 = v0.update(1, [](bool_vec vec) { return vec.set(8, true); }); - - CHECK(v0[1] != v1[1]); - CHECK(v0 != v1); -} diff --git a/third_party/immer/test/vector/issue-74.cpp b/third_party/immer/test/vector/issue-74.cpp deleted file mode 100644 index 8650be014f1f..000000000000 --- a/third_party/immer/test/vector/issue-74.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "immer/box.hpp" -#include "immer/set.hpp" -#include "immer/vector.hpp" - -#include <functional> - -struct my_type -{ - using container_t = immer::vector<immer::box<my_type>>; - using func_t = std::function<int(int)>; - - int ival; - double dval; - func_t func; - container_t children; -}; - -int main() -{ - my_type::container_t items = {my_type()}; - immer::set<int> items2; - auto items3 = items2.insert(10); - return 0; -} |