forked from OSchip/llvm-project
Improve portability of hash tests. Patch from STL@microsoft.com
llvm-svn: 272744
This commit is contained in:
parent
c4989d27b5
commit
78f8ce484f
|
@ -16,12 +16,12 @@
|
|||
// size_t operator()(T val) const;
|
||||
// };
|
||||
|
||||
// Not very portable
|
||||
|
||||
#include <system_error>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
void
|
||||
test(int i)
|
||||
{
|
||||
|
@ -31,7 +31,9 @@ test(int i)
|
|||
static_assert((std::is_same<H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
T ec(i, std::system_category());
|
||||
assert(h(ec) == i);
|
||||
const std::size_t result = h(ec);
|
||||
LIBCPP_ASSERT(result == i);
|
||||
((void)result); // Prevent unused warning
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
|
@ -16,12 +16,12 @@
|
|||
// size_t operator()(T val) const;
|
||||
// };
|
||||
|
||||
// Not very portable
|
||||
|
||||
#include <bitset>
|
||||
#include <cassert>
|
||||
#include <type_traits>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
template <std::size_t N>
|
||||
void
|
||||
test()
|
||||
|
@ -32,7 +32,9 @@ test()
|
|||
static_assert((std::is_same<typename H::result_type, std::size_t>::value), "" );
|
||||
H h;
|
||||
T bs(static_cast<unsigned long long>(N));
|
||||
assert(h(bs) == N);
|
||||
const std::size_t result = h(bs);
|
||||
LIBCPP_ASSERT(result == N);
|
||||
((void)result); // Prevent unused warning
|
||||
}
|
||||
|
||||
int main()
|
||||
|
|
Loading…
Reference in New Issue