Author: ericwf Date: Tue Jun 14 20:42:35 2016 New Revision: 272744 URL: http://llvm.org/viewvc/llvm-project?rev=272744&view=rev Log: Improve portability of hash tests. Patch from s...@microsoft.com
Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp Modified: libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp?rev=272744&r1=272743&r2=272744&view=diff ============================================================================== --- libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp (original) +++ libcxx/trunk/test/std/diagnostics/syserr/syserr.hash/error_code.pass.cpp Tue Jun 14 20:42:35 2016 @@ -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() Modified: libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp?rev=272744&r1=272743&r2=272744&view=diff ============================================================================== --- libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp (original) +++ libcxx/trunk/test/std/utilities/template.bitset/bitset.hash/bitset.pass.cpp Tue Jun 14 20:42:35 2016 @@ -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() _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits