Skip to content

Commit 3125d4a

Browse files
authored
Merge pull request #1271 from SekaiArendelle/fix-vector
Avoid disable all tests for fast_io::vector
2 parents 63a6299 + fe539aa commit 3125d4a

14 files changed

Lines changed: 79 additions & 36 deletions

tests/0026.container/.test_prop.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/0026.container/0001.vector/append_range.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ using namespace fast_io::mnp;
88

99
int main()
1010
{
11+
#if 0
1112
auto head = fast_io::vector<int>{1, 2, 3, 4};
1213
auto const tail = std::list{-5, -6, -7};
1314
head.append_range(tail);
1415
assert(std::ranges::equal(head, fast_io::vector<int>{1, 2, 3, 4, -5, -6, -7}));
16+
#endif
1517
}

tests/0026.container/0001.vector/assign.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ int main()
2020
characters.assign(5, 'a');
2121
print_vector();
2222

23+
#if 0
2324
std::string const extra(6, 'b');
2425
characters.assign(extra.begin(), extra.end());
2526
print_vector();
2627

2728
characters.assign({'C', '+', '+', '1', '1'});
2829
print_vector();
29-
}
30+
#endif
31+
}

tests/0026.container/0001.vector/assign_range.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66

77
int main()
88
{
9+
#if 0
910
auto const source = std::list{2, 7, 1};
1011
auto destination = fast_io::vector{3, 1, 4};
1112
destination.assign_range(source);
1213
assert(std::ranges::equal(source, destination));
14+
#endif
1315
}

tests/0026.container/0001.vector/capacity.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ int main()
1818
v.push_back(sz);
1919
if (cap != v.capacity())
2020
{
21-
println(left(v.size(), 7), left(v.capacity(), 11), left(v.capacity() / static_cast<float>(cap), 10));
21+
println(left(v.size(), 7), left(v.capacity(), 11), left(float(v.capacity()) / static_cast<float>(cap), 10));
2222
cap = v.capacity();
2323
}
2424
}
2525

2626
println("\nFinal size: ", v.size(), ", capacity: ", v.capacity());
27-
}
27+
}

tests/0026.container/0001.vector/emplace_back.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#include <cassert>
2-
#include <string>
1+
#include <string>
32
#include <fast_io.h>
43
#include <fast_io_dsal/vector.h>
54
using namespace fast_io::io;
@@ -31,7 +30,10 @@ int main()
3130
fast_io::vector<President> elections;
3231
print("emplace_back:\n");
3332
auto &ref = elections.emplace_back("Nelson Mandela", "South Africa", 1994);
34-
assert(ref.year == 1994 && "uses a reference to the created object (C++17)");
33+
if (ref.year != 1994)
34+
{
35+
::fast_io::fast_terminate();
36+
}
3537

3638
fast_io::vector<President> reElections;
3739
print("\npush_back:\n");

tests/0026.container/0001.vector/insert.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ int main()
1717
auto it = c1.begin();
1818
it = c1.insert(it, 200);
1919
print_info(2, c1);
20-
20+
#if 0
2121
c1.insert(it, 2, 300);
2222
print_info(3, c1);
2323

@@ -34,4 +34,5 @@ int main()
3434

3535
c1.insert(c1.end(), {601, 602, 603});
3636
print_info(6, c1);
37+
#endif
3738
}

tests/0026.container/0001.vector/insert_range.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ using namespace fast_io::mnp;
99

1010
int main()
1111
{
12+
#if 0
1213
auto container = fast_io::vector{1, 2, 3, 4};
1314
auto pos = std::next(container.begin(), 2);
1415
assert(*pos == 3);
1516
auto const rg = std::list{-1, -2, -3};
1617

1718
container.insert_range(pos, rg);
1819
assert(std::ranges::equal(container, fast_io::vector{1, 2, -1, -2, -3, 3, 4}));
20+
#endif
1921
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#include <fast_io.h>
2-
#include <fast_io_i18n.h>
2+
// #include <fast_io_i18n.h>
33
#include <fast_io_dsal/vector.h>
44
using namespace fast_io::io;
55
using namespace fast_io::mnp;
66

77
int main()
88
{
9+
#if 0
910
fast_io::vector<char> q;
1011
fast_io::native_l10n l10n{"en_US.UTF-8"};
1112
println(imbue(l10n, fast_io::c_stdout()), "Maximum size of a std::vector is ", q.max_size());
13+
#endif
1214
}

tests/0026.container/0001.vector/operator_assign.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ using namespace fast_io::mnp;
88
int main()
99
{
1010
fast_io::vector<int> x{1, 2, 3}, y, z;
11-
auto const w = {4, 5, 6, 7};
1211

1312
print("Initially:\n");
1413
print("x = {", rgvw(x, ", "), "}\ny = {", rgvw(y, ", "), "}\nz = {", rgvw(z, ", "), "}\n");
@@ -21,7 +20,11 @@ int main()
2120
z = std::move(x);
2221
print("x = {", rgvw(x, ", "), "}\nz = {", rgvw(z, ", "), "}\n");
2322

23+
#if 0
24+
auto const w = {4, 5, 6, 7};
25+
2426
print("Assignment of initializer_list w to z:\n");
2527
z = w;
2628
print("w = {", rgvw(w, ", "), "}\nz = {", rgvw(z, ", "), "}\n");
29+
#endif
2730
}

0 commit comments

Comments
 (0)