1 // Copyright 2016 The Fuchsia Authors
2 //
3 // Use of this source code is governed by a MIT-style
4 // license that can be found in the LICENSE file or at
5 // https://opensource.org/licenses/MIT
6 
7 #include <lib/crypto/global_prng.h>
8 
9 #include <lib/unittest/unittest.h>
10 #include <stdint.h>
11 
12 namespace crypto {
13 
14 namespace {
identical()15 bool identical() {
16     BEGIN_TEST;
17 
18     PRNG* prng1 = GlobalPRNG::GetInstance();
19     PRNG* prng2 = GlobalPRNG::GetInstance();
20 
21     EXPECT_NE(prng1, nullptr, "");
22     EXPECT_EQ(prng1, prng2, "");
23 
24     END_TEST;
25 }
26 
27 } // namespace
28 
29 UNITTEST_START_TESTCASE(global_prng_tests)
30 UNITTEST("Identical", identical)
31 UNITTEST_END_TESTCASE(global_prng_tests, "global_prng",
32                       "Validate global PRNG singleton");
33 
34 } // namespace crypto
35