[PATCH] D21346: [libcxx] [test] Improve portability of random_device tests.
Stephan T. Lavavej via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 14 14:14:40 PDT 2016
STL_MSFT created this revision.
STL_MSFT added reviewers: EricWF, mclow.lists.
STL_MSFT added a subscriber: cfe-commits.
Improve portability of random_device tests.
These tests were failing for MSVC, because we ignore the token (as permitted by the Standard). Marking the asserts as libcxx-specific is all we need.
http://reviews.llvm.org/D21346
Files:
test/std/numerics/rand/rand.device/ctor.pass.cpp
test/std/numerics/rand/rand.device/eval.pass.cpp
Index: test/std/numerics/rand/rand.device/eval.pass.cpp
===================================================================
--- test/std/numerics/rand/rand.device/eval.pass.cpp
+++ test/std/numerics/rand/rand.device/eval.pass.cpp
@@ -17,6 +17,8 @@
#include <random>
#include <cassert>
+#include "test_macros.h"
+
int main()
{
{
@@ -28,7 +30,7 @@
{
std::random_device r("/dev/null");
r();
- assert(false);
+ LIBCPP_ASSERT(false);
}
catch (const std::system_error&)
{
Index: test/std/numerics/rand/rand.device/ctor.pass.cpp
===================================================================
--- test/std/numerics/rand/rand.device/ctor.pass.cpp
+++ test/std/numerics/rand/rand.device/ctor.pass.cpp
@@ -27,6 +27,8 @@
#include <unistd.h>
#endif
+#include "test_macros.h"
+
bool is_valid_random_device(const std::string &token) {
#if defined(_LIBCPP_USING_DEV_RANDOM)
@@ -44,7 +46,7 @@
void check_random_device_invalid(const std::string &token) {
try {
std::random_device r(token);
- assert(false);
+ LIBCPP_ASSERT(false);
} catch (const std::system_error&) {
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21346.60750.patch
Type: text/x-patch
Size: 1152 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160614/b4558635/attachment.bin>
More information about the cfe-commits
mailing list