Skip to content

Commit 38d2fe3

Browse files
Templatize tests, remove unused inclusion
1 parent 7db09d6 commit 38d2fe3

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

libcxx/test/libcxx/containers/sequences/vector.bool/hash.constexpr.pass.cpp

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,21 @@
1818
#include <vector>
1919

2020
#include "min_allocator.h"
21-
#include "poisoned_hash_helper.h"
21+
22+
template <class VBType>
23+
constexpr void test() {
24+
bool ba[]{true, false, true, true, false};
25+
VBType vb(std::begin(ba), std::end(ba));
26+
27+
const std::hash<VBType> h{};
28+
const auto hash_value = h(vb);
29+
assert(hash_value == h(vb));
30+
assert(hash_value != 0);
31+
}
2232

2333
constexpr bool test() {
24-
{
25-
using VB = std::vector<bool>;
26-
bool ba[]{true, false, true, true, false};
27-
VB vb(std::begin(ba), std::end(ba));
28-
29-
const std::hash<VB> h{};
30-
const auto hash_value = h(vb);
31-
assert(hash_value == h(vb));
32-
assert(hash_value != 0);
33-
}
34-
{
35-
using VB = std::vector<bool, min_allocator<bool>>;
36-
bool ba[] = {true, false, true, true, false};
37-
VB vb(std::begin(ba), std::end(ba));
38-
39-
const std::hash<VB> h{};
40-
const auto hash_value = h(vb);
41-
assert(hash_value == h(vb));
42-
assert(hash_value != 0);
43-
}
34+
test<std::vector<bool>>();
35+
test<std::vector<bool, min_allocator<bool>>>();
4436

4537
return true;
4638
}

0 commit comments

Comments
 (0)