proxygen
RandomGeneratorTest.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-present, Facebook, Inc.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #include <gtest/gtest.h>
10 
12 
14 
15 using namespace testing;
16 
17 namespace fizz {
18 namespace test {
19 
20 TEST(RandomGeneratorTest, TestRandom) {
21  useMockRandom();
22 
23  auto random = RandomGenerator<32>().generateRandom();
24  std::array<uint8_t, 32> expected;
25  expected.fill(0x44);
26  EXPECT_EQ(random, expected);
27 }
28 
29 TEST(RandomGeneratorTest, TestRandomUInt32) {
30  useMockRandom();
31 
32  auto random = RandomNumGenerator<uint32_t>().generateRandom();
33  EXPECT_EQ(random, 0x44444444);
34 }
35 } // namespace test
36 } // namespace fizz
Integral2 random(Integral1 low, Integral2 up)
#define EXPECT_EQ(val1, val2)
Definition: gtest.h:1922
void useMockRandom()
Definition: TestUtil.cpp:69
TEST(GTestEnvVarTest, Dummy)
Definition: Actions.h:16