[libcxx-commits] [libcxx] r374248 - [libc++][test] Miscellaneous MSVC cleanups
Casey Carter via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Oct 9 15:19:17 PDT 2019
Author: caseycarter
Date: Wed Oct 9 15:19:17 2019
New Revision: 374248
URL: http://llvm.org/viewvc/llvm-project?rev=374248&view=rev
Log:
[libc++][test] Miscellaneous MSVC cleanups
* Silence unused-local-typedef warnings: `map.cons/assign_initializer_list.pass.cpp` (and the `set.cons` variant) uses a local typedef only within `LIBCPP_ASSERT`s, so clang diagnoses it as unused when testing non-libc++.
* Add missing include: `c.math/abs.pass.cpp` uses `std::numeric_limits` but failed to `#include <limits>`.
* Don't test non-type: A "recent" change to `meta.trans.other/underlying_type.pass.cpp` unconditionally tests the type `F` which is conditionally defined.
* Use `hash<long long>` instead of `hash<short>` with `int` in `unordered_meow` deduction guide tests to avoid truncation warnings.
* Convert `3.14` explicitly in `midpoint.float.pass` since MSVC incorrectly diagnoses `float meow = 3.14;` as truncating.
Differential Revision: https://reviews.llvm.org/D68681
Modified:
libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp
libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
Modified: libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/map/map.cons/assign_initializer_list.pass.cpp Wed Oct 9 15:19:17 2019
@@ -75,23 +75,22 @@ void test_basic() {
void duplicate_keys_test() {
typedef std::map<int, int, std::less<int>, test_allocator<std::pair<const int, int> > > 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;
}
Modified: libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/associative/set/set.cons/assign_initializer_list.pass.cpp Wed Oct 9 15:19:17 2019
@@ -57,17 +57,16 @@ void basic_test() {
void duplicate_keys_test() {
typedef std::set<int, std::less<int>, test_allocator<int> > 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**) {
Modified: libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.map/unord.map.cnstr/deduct.pass.cpp Wed Oct 9 15:19:17 2019
@@ -87,22 +87,22 @@ int main(int, char**)
{
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<short>());
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>>);
+ std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>());
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>>);
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<short>(), std::equal_to<>());
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>>);
+ std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), std::equal_to<>());
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, 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<short>(), std::equal_to<>(), test_allocator<PC>(0, 41));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), std::equal_to<>(), test_allocator<PC>(0, 41));
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
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 @@ int main(int, char**)
}
{
- std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>> source;
+ std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 42);
std::unordered_map m(source, a);
ASSERT_SAME_TYPE(decltype(m), decltype(source));
@@ -131,7 +131,7 @@ int main(int, char**)
}
{
- std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>> source;
+ std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>> source;
test_allocator<PC> a(0, 43);
std::unordered_map m{source, a}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(m), decltype(source));
@@ -152,20 +152,20 @@ int main(int, char**)
}
{
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>());
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>>);
+ std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>());
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>>);
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<short>(), std::equal_to<>());
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, 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<long long>(), std::equal_to<>());
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, 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<short>(), std::equal_to<>(), test_allocator<PC>(0, 44));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<>, test_allocator<PC>>);
+ std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<PC>(0, 44));
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<>, test_allocator<PC>>);
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 @@ int main(int, char**)
{
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<short>(), test_allocator<PC>(0, 46));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ std::unordered_map m(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<PC>(0, 46));
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
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 @@ int main(int, char**)
}
{
- std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<short>(), test_allocator<PC>(0, 48));
- ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<short>, std::equal_to<int>, test_allocator<PC>>);
+ std::unordered_map m({ P{1,1L}, P{2,2L}, P{1,1L}, P{INT_MAX,1L}, P{3,1L} }, 42, std::hash<long long>(), test_allocator<PC>(0, 48));
+ ASSERT_SAME_TYPE(decltype(m), std::unordered_map<int, long, std::hash<long long>, std::equal_to<int>, test_allocator<PC>>);
assert(std::is_permutation(m.begin(), m.end(), std::begin(expected_m), std::end(expected_m)));
assert(m.get_allocator().get_id() == 48);
}
Modified: libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.multiset/unord.multiset.cnstr/deduct.pass.cpp Wed Oct 9 15:19:17 2019
@@ -78,37 +78,37 @@ int main(int, char**)
{
const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<short>());
+ std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>>);
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<short>(), test_allocator<int>(0, 40));
+ std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 40));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
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<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s(source);
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
}
{
- std::unordered_multiset<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
}
{
- std::unordered_multiset<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s(source, test_allocator<int>(0, 41));
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
@@ -116,7 +116,7 @@ int main(int, char**)
}
{
- std::unordered_multiset<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_multiset s{source, test_allocator<int>(0, 42)}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
@@ -138,23 +138,23 @@ int main(int, char**)
}
{
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<short>());
+ std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>>);
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<short>(), std::equal_to<>());
+ std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>, std::equal_to<>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, 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<short>(), std::equal_to<>(), test_allocator<int>(0, 43));
+ std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>, std::equal_to<>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<>, test_allocator<int>>);
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 @@ int main(int, char**)
{
const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<short>(), test_allocator<int>(0, 44));
+ std::unordered_multiset s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
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 @@ int main(int, char**)
}
{
- std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<short>(), test_allocator<int>(0, 42));
+ std::unordered_multiset s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_multiset<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
}
Modified: libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp (original)
+++ libcxx/trunk/test/std/containers/unord/unord.set/unord.set.cnstr/deduct.pass.cpp Wed Oct 9 15:19:17 2019
@@ -78,37 +78,37 @@ int main(int, char**)
{
const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<short>());
+ std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>>);
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<short>(), test_allocator<int>(0, 40));
+ std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 40));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
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<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s(source);
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
}
{
- std::unordered_set<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s{source}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
}
{
- std::unordered_set<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s(source, test_allocator<int>(0, 41));
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
@@ -116,7 +116,7 @@ int main(int, char**)
}
{
- std::unordered_set<int, std::hash<short>, std::equal_to<>, test_allocator<int>> source;
+ std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>> source;
std::unordered_set s{source, test_allocator<int>(0, 42)}; // braces instead of parens
ASSERT_SAME_TYPE(decltype(s), decltype(source));
assert(s.size() == 0);
@@ -138,23 +138,23 @@ int main(int, char**)
}
{
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<short>());
+ std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>>);
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<short>(), std::equal_to<>());
+ std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>());
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>, std::equal_to<>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, 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<short>(), std::equal_to<>(), test_allocator<int>(0, 43));
+ std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), std::equal_to<>(), test_allocator<int>(0, 43));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>, std::equal_to<>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<>, test_allocator<int>>);
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 @@ int main(int, char**)
{
const int arr[] = { 1, 2, 1, INT_MAX, 3 };
- std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<short>(), test_allocator<int>(0, 44));
+ std::unordered_set s(std::begin(arr), std::end(arr), 42, std::hash<long long>(), test_allocator<int>(0, 44));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
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 @@ int main(int, char**)
}
{
- std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<short>(), test_allocator<int>(0, 42));
+ std::unordered_set s({ 1, 2, 1, INT_MAX, 3 }, 42, std::hash<long long>(), test_allocator<int>(0, 42));
- ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<short>, std::equal_to<int>, test_allocator<int>>);
+ ASSERT_SAME_TYPE(decltype(s), std::unordered_set<int, std::hash<long long>, std::equal_to<int>, test_allocator<int>>);
assert(std::is_permutation(s.begin(), s.end(), std::begin(expected_s), std::end(expected_s)));
assert(s.get_allocator().get_id() == 42);
}
Modified: libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/c.math/abs.pass.cpp Wed Oct 9 15:19:17 2019
@@ -9,6 +9,7 @@
#include <assert.h>
#include <cmath>
#include <cstdint>
+#include <limits>
#include <type_traits>
#include "test_macros.h"
@@ -75,4 +76,3 @@ int main(int, char**)
return 0;
}
-
Modified: libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp (original)
+++ libcxx/trunk/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.float.pass.cpp Wed Oct 9 15:19:17 2019
@@ -41,7 +41,7 @@ void fp_test()
constexpr T maxV = std::numeric_limits<T>::max();
constexpr T minV = std::numeric_limits<T>::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 @@ void fp_test()
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 @@ void fp_test()
// 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
Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp?rev=374248&r1=374247&r2=374248&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/underlying_type.pass.cpp Wed Oct 9 15:19:17 2019
@@ -42,7 +42,7 @@ void check()
ASSERT_SAME_TYPE(Expected, typename std::underlying_type<T>::type);
#if TEST_STD_VER > 11
ASSERT_SAME_TYPE(Expected, typename std::underlying_type_t<T>);
-#endif
+#endif
}
enum E { V = INT_MIN };
@@ -79,7 +79,9 @@ int main(int, char**)
// SFINAE-able underlying_type
#if TEST_STD_VER > 17
static_assert( has_type_member<E>::value, "");
+#ifdef TEST_UNSIGNED_UNDERLYING_TYPE
static_assert( has_type_member<F>::value, "");
+#endif // TEST_UNSIGNED_UNDERLYING_TYPE
static_assert( has_type_member<G>::value, "");
static_assert(!has_type_member<void>::value, "");
More information about the libcxx-commits
mailing list