diff --git a/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp --- a/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp @@ -75,23 +75,22 @@ void duplicate_keys_test() { typedef std::map, test_allocator > > Map; - typedef test_alloc_base AllocBase; { - LIBCPP_ASSERT(AllocBase::alloc_count == 0); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 0); Map s = {{1, 0}, {2, 0}, {3, 0}}; - LIBCPP_ASSERT(AllocBase::alloc_count == 3); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 3); s = {{4, 0}, {4, 0}, {4, 0}, {4, 0}}; - LIBCPP_ASSERT(AllocBase::alloc_count == 1); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 1); assert(s.size() == 1); assert(s.begin()->first == 4); } - LIBCPP_ASSERT(AllocBase::alloc_count == 0); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 0); } int main(int, char**) { - test_basic(); - duplicate_keys_test(); + test_basic(); + duplicate_keys_test(); return 0; } diff --git a/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp b/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp --- a/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp +++ b/libcxx/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp @@ -57,17 +57,16 @@ void duplicate_keys_test() { typedef std::set, test_allocator > Set; - typedef test_alloc_base AllocBase; { - LIBCPP_ASSERT(AllocBase::alloc_count == 0); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 0); Set s = {1, 2, 3}; - LIBCPP_ASSERT(AllocBase::alloc_count == 3); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 3); s = {4, 4, 4, 4, 4}; - LIBCPP_ASSERT(AllocBase::alloc_count == 1); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 1); assert(s.size() == 1); assert(*s.begin() == 4); } - LIBCPP_ASSERT(AllocBase::alloc_count == 0); + LIBCPP_ASSERT(test_alloc_base::alloc_count == 0); } int main(int, char**) { diff --git a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp --- a/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp @@ -87,22 +87,22 @@ { const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} }; - std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash()); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to>); + std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash()); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); } { const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} }; - std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), std::equal_to<>()); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>>); + std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), std::equal_to<>()); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); } { const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} }; - std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), std::equal_to<>(), test_allocator(0, 41)); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>, test_allocator>); + std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), std::equal_to<>(), test_allocator(0, 41)); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>, test_allocator>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); assert(m.get_allocator().get_id() == 41); } @@ -122,7 +122,7 @@ } { - std::unordered_map, std::equal_to<>, test_allocator> source; + std::unordered_map, std::equal_to<>, test_allocator> source; test_allocator a(0, 42); std::unordered_map m(source, a); ASSERT_SAME_TYPE(decltype(m), decltype(source)); @@ -131,7 +131,7 @@ } { - std::unordered_map, std::equal_to<>, test_allocator> source; + std::unordered_map, std::equal_to<>, test_allocator> source; test_allocator a(0, 43); std::unordered_map m{source, a}; // braces instead of parens ASSERT_SAME_TYPE(decltype(m), decltype(source)); @@ -152,20 +152,20 @@ } { - std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash()); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map>); + std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash()); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); } { - std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), std::equal_to<>()); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>>); + std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), std::equal_to<>()); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); } { - std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 44)); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>, test_allocator>); + std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 44)); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to<>, test_allocator>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); assert(m.get_allocator().get_id() == 44); } @@ -180,8 +180,8 @@ { const P arr[] = { {1,1}, {2,2}, {1,1}, {INT_MAX,1}, {3,1} }; - std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 46)); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to, test_allocator>); + std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 46)); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to, test_allocator>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); assert(m.get_allocator().get_id() == 46); } @@ -194,8 +194,8 @@ } { - std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), test_allocator(0, 48)); - ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to, test_allocator>); + std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash(), test_allocator(0, 48)); + ASSERT_SAME_TYPE(decltype(m), std::unordered_map, std::equal_to, test_allocator>); assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m))); assert(m.get_allocator().get_id() == 48); } diff --git a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp --- a/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp @@ -78,37 +78,37 @@ { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash()); + std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 40)); + std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 40)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 40); } { - std::unordered_multiset, std::equal_to<>, test_allocator> source; + std::unordered_multiset, std::equal_to<>, test_allocator> source; std::unordered_multiset s(source); ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); } { - std::unordered_multiset, std::equal_to<>, test_allocator> source; + std::unordered_multiset, std::equal_to<>, test_allocator> source; std::unordered_multiset s{source}; // braces instead of parens ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); } { - std::unordered_multiset, std::equal_to<>, test_allocator> source; + std::unordered_multiset, std::equal_to<>, test_allocator> source; std::unordered_multiset s(source, test_allocator(0, 41)); ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); @@ -116,7 +116,7 @@ } { - std::unordered_multiset, std::equal_to<>, test_allocator> source; + std::unordered_multiset, std::equal_to<>, test_allocator> source; std::unordered_multiset s{source, test_allocator(0, 42)}; // braces instead of parens ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); @@ -138,23 +138,23 @@ } { - std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash()); + std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { - std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>()); + std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to<>>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to<>>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { - std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 43)); + std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 43)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to<>, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to<>, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 43); } @@ -170,9 +170,9 @@ { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 44)); + std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 44)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 44); } @@ -186,9 +186,9 @@ } { - std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), test_allocator(0, 42)); + std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), test_allocator(0, 42)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 42); } diff --git a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp --- a/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp +++ b/libcxx/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp @@ -78,37 +78,37 @@ { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash()); + std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 40)); + std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 40)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 40); } { - std::unordered_set, std::equal_to<>, test_allocator> source; + std::unordered_set, std::equal_to<>, test_allocator> source; std::unordered_set s(source); ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); } { - std::unordered_set, std::equal_to<>, test_allocator> source; + std::unordered_set, std::equal_to<>, test_allocator> source; std::unordered_set s{source}; // braces instead of parens ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); } { - std::unordered_set, std::equal_to<>, test_allocator> source; + std::unordered_set, std::equal_to<>, test_allocator> source; std::unordered_set s(source, test_allocator(0, 41)); ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); @@ -116,7 +116,7 @@ } { - std::unordered_set, std::equal_to<>, test_allocator> source; + std::unordered_set, std::equal_to<>, test_allocator> source; std::unordered_set s{source, test_allocator(0, 42)}; // braces instead of parens ASSERT_SAME_TYPE(decltype(s), decltype(source)); assert(s.size() == 0); @@ -138,23 +138,23 @@ } { - std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash()); + std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { - std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>()); + std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>()); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to<>>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to<>>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); } { - std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 43)); + std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), std::equal_to<>(), test_allocator(0, 43)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to<>, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to<>, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 43); } @@ -170,9 +170,9 @@ { const int arr[] = { 1, 2, 1, INT_MAX, 3 }; - std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 44)); + std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash(), test_allocator(0, 44)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 44); } @@ -186,9 +186,9 @@ } { - std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), test_allocator(0, 42)); + std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash(), test_allocator(0, 42)); - ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); + ASSERT_SAME_TYPE(decltype(s), std::unordered_set, std::equal_to, test_allocator>); assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s))); assert(s.get_allocator().get_id() == 42); } diff --git a/libcxx/test/std/numerics/c.math/abs.pass.cpp b/libcxx/test/std/numerics/c.math/abs.pass.cpp --- a/libcxx/test/std/numerics/c.math/abs.pass.cpp +++ b/libcxx/test/std/numerics/c.math/abs.pass.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "test_macros.h" @@ -75,4 +76,3 @@ return 0; } - diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp --- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp +++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp @@ -41,7 +41,7 @@ constexpr T maxV = std::numeric_limits::max(); constexpr T minV = std::numeric_limits::min(); - + // Things that can be compared exactly static_assert((std::midpoint(T(0), T(0)) == T(0)), ""); static_assert((std::midpoint(T(2), T(4)) == T(3)), ""); @@ -58,7 +58,7 @@ assert((fptest_close_pct(std::midpoint(T(0.1), T(0.4)), T(0.25), pct))); assert((fptest_close_pct(std::midpoint(T(11.2345), T(14.5432)), T(12.88885), pct))); - + // From e to pi assert((fptest_close_pct(std::midpoint(T(2.71828182845904523536028747135266249775724709369995), T(3.14159265358979323846264338327950288419716939937510)), @@ -86,7 +86,7 @@ // TODO // Check two values "close to each other" - T d1 = 3.14; + T d1 = T(3.14); T d0 = std::nextafter(d1, T(2)); T d2 = std::nextafter(d1, T(5)); assert(d0 < d1); // sanity checking diff --git a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp --- a/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp +++ b/libcxx/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp @@ -42,7 +42,7 @@ ASSERT_SAME_TYPE(Expected, typename std::underlying_type::type); #if TEST_STD_VER > 11 ASSERT_SAME_TYPE(Expected, typename std::underlying_type_t); -#endif +#endif } enum E { V = INT_MIN }; @@ -79,7 +79,9 @@ // SFINAE-able underlying_type #if TEST_STD_VER > 17 static_assert( has_type_member::value, ""); +#ifdef TEST_UNSIGNED_UNDERLYING_TYPE static_assert( has_type_member::value, ""); +#endif // TEST_UNSIGNED_UNDERLYING_TYPE static_assert( has_type_member::value, ""); static_assert(!has_type_member::value, "");