Improve portability of hash tests. Patch from STL@microsoft.com
llvm-svn: 272744
GitOrigin-RevId: 78f8ce484f8373a196ab729e00a045972d91d7f3
diff --git a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
index b812e36..c8b3d98 100644
--- a/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
+++ b/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp
@@ -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 @@
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()
diff --git a/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp b/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
index 520f2e8..bc65078 100644
--- a/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
+++ b/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp
@@ -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 @@
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()