blob: c6e01ac250a8a8c5cad921e22a1faf04bcf0aabc [file] [log] [blame]
Howard Hinnant3e519522010-05-11 19:42:16 +00001//===----------------------------------------------------------------------===//
2//
Howard Hinnant5b08a8a2010-05-11 21:36:01 +00003// The LLVM Compiler Infrastructure
Howard Hinnant3e519522010-05-11 19:42:16 +00004//
Howard Hinnant412dbeb2010-11-16 22:09:02 +00005// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
Howard Hinnant3e519522010-05-11 19:42:16 +00007//
8//===----------------------------------------------------------------------===//
9
Mehdi Aminie9c66ad2017-05-04 17:08:54 +000010// XFAIL: with_system_cxx_lib=macosx10.11
11// XFAIL: with_system_cxx_lib=macosx10.10
12// XFAIL: with_system_cxx_lib=macosx10.9
13// XFAIL: with_system_cxx_lib=macosx10.8
14// XFAIL: with_system_cxx_lib=macosx10.7
15
Howard Hinnant3e519522010-05-11 19:42:16 +000016// <random>
17
18// class random_device;
19
20// result_type operator()();
21
22#include <random>
23#include <cassert>
24
Eric Fiselier0a707552016-06-15 01:50:31 +000025#include "test_macros.h"
26
Howard Hinnant3e519522010-05-11 19:42:16 +000027int main()
28{
David Majnemer2dfdfdf2014-06-03 02:40:39 +000029 {
30 std::random_device r;
31 std::random_device::result_type e = r();
Stephan T. Lavavej4dc0ed82016-11-14 17:35:14 +000032 ((void)e); // Prevent unused warning
David Majnemer2dfdfdf2014-06-03 02:40:39 +000033 }
34
Roger Ferrer Ibanez8cba0be2016-11-01 08:11:12 +000035#ifndef TEST_HAS_NO_EXCEPTIONS
David Majnemer2dfdfdf2014-06-03 02:40:39 +000036 try
37 {
38 std::random_device r("/dev/null");
39 r();
Eric Fiselier0a707552016-06-15 01:50:31 +000040 LIBCPP_ASSERT(false);
David Majnemer2dfdfdf2014-06-03 02:40:39 +000041 }
Eric Fiselierfb42f4c2016-05-02 19:15:48 +000042 catch (const std::system_error&)
David Majnemer2dfdfdf2014-06-03 02:40:39 +000043 {
44 }
Roger Ferrer Ibanez8cba0be2016-11-01 08:11:12 +000045#endif
Howard Hinnant3e519522010-05-11 19:42:16 +000046}