From 037195f0dfd09e4f3b393e061111c5e62cba80f4 Mon Sep 17 00:00:00 2001 From: Hui Date: Sat, 26 Oct 2024 16:00:10 +0100 Subject: [PATCH] tests --- .../flat.map/op_compare.pass.cpp | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/libcxx/test/std/containers/container.adaptors/flat.map/op_compare.pass.cpp b/libcxx/test/std/containers/container.adaptors/flat.map/op_compare.pass.cpp index 6782b4c0c50db9..fffe7115807040 100644 --- a/libcxx/test/std/containers/container.adaptors/flat.map/op_compare.pass.cpp +++ b/libcxx/test/std/containers/container.adaptors/flat.map/op_compare.pass.cpp @@ -16,18 +16,27 @@ #include #include +#include #include #include #include #include #include +#include "MinSequenceContainer.h" +#include "test_macros.h" +#include "min_allocator.h" +#include "test_allocator.h" #include "test_comparisons.h" #include "test_container_comparisons.h" -int main(int, char**) { +template +void test() { + using Key = typename KeyContainer::value_type; + using Value = typename ValueContainer::value_type; + { - using C = std::flat_map; + using C = std::flat_map; C s1 = {{1, 1}}; C s2 = {{2, 0}}; // {{1,1}} versus {{2,0}} ASSERT_SAME_TYPE(decltype(s1 <=> s2), std::strong_ordering); @@ -44,7 +53,7 @@ int main(int, char**) { } { // Comparisons use value_type's native operators, not the comparator - using C = std::flat_map>; + using C = std::flat_map>; C s1 = {{1, 1}}; C s2 = {{2, 0}}; // {{1,1}} versus {{2,0}} ASSERT_SAME_TYPE(decltype(s1 <=> s2), std::strong_ordering); @@ -59,6 +68,15 @@ int main(int, char**) { s2 = {{0, 0}, {1, 1}, {2, 3}}; // {{2,2},{1,1},{0,0}} versus {{2,3},{1,1},{0,0}} assert(testComparisons(s1, s2, false, true)); } +} + +int main(int, char**) { + test, std::vector>(); + test, std::deque>(); + test, MinSequenceContainer>(); + test>, std::vector>>(); + test>, std::vector>>(); + { using C = std::flat_map; C s1 = {{1, 1}};