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&) {
}
}
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&) {
}
}
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits