1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // <random> 11 12 // class random_device; 13 14 // result_type operator()(); 15 16 #include <random> 17 #include <cassert> 18 19 #include "test_macros.h" 20 21 int main() 22 { 23 { 24 std::random_device r; 25 std::random_device::result_type e = r(); 26 ((void)e); // Prevent unused warning 27 } 28 29 #ifndef TEST_HAS_NO_EXCEPTIONS 30 try 31 { 32 std::random_device r("/dev/null"); 33 r(); 34 LIBCPP_ASSERT(false); 35 } 36 catch (const std::system_error&) 37 { 38 } 39 #endif 40 } 41