forked from OSchip/llvm-project
Improve portability of random_device tests. Patch from STL@microsoft.com
llvm-svn: 272746
This commit is contained in:
parent
5d3e09ecc1
commit
0a707553a5
|
@ -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_valid(const std::string &token) {
|
|||
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&) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
#include <random>
|
||||
#include <cassert>
|
||||
|
||||
#include "test_macros.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
|
@ -28,7 +30,7 @@ int main()
|
|||
{
|
||||
std::random_device r("/dev/null");
|
||||
r();
|
||||
assert(false);
|
||||
LIBCPP_ASSERT(false);
|
||||
}
|
||||
catch (const std::system_error&)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue