From 78440734029c40841904a05663c2c38e7b258214 Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Tue, 4 Feb 2014 14:49:21 +0000 Subject: Implemented support for Process::GetRandomNumber on Windows. Patch thanks to Stephan Tolksdorf! llvm-svn: 200767 --- llvm/unittests/Support/ProcessTest.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'llvm/unittests/Support/ProcessTest.cpp') diff --git a/llvm/unittests/Support/ProcessTest.cpp b/llvm/unittests/Support/ProcessTest.cpp index af6a6f921b0..19694e55d06 100644 --- a/llvm/unittests/Support/ProcessTest.cpp +++ b/llvm/unittests/Support/ProcessTest.cpp @@ -39,6 +39,13 @@ TEST(ProcessTest, SelfProcess) { EXPECT_GT(TimeValue::MaxTime, process::get_self()->get_wall_time()); } +TEST(ProcessTest, GetRandomNumberTest) { + const unsigned r1 = Process::GetRandomNumber(); + const unsigned r2 = Process::GetRandomNumber(); + // It should be extremely unlikely that both r1 and r2 are 0. + EXPECT_NE((r1 | r2), 0); +} + #ifdef _MSC_VER #define setenv(name, var, ignore) _putenv_s(name, var) #endif -- cgit v1.2.3