• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <gtest/gtest.h>
2 #include <stdlib.h>
3 
4 using namespace testing::ext;
5 
6 class PrngRandTest : public testing::Test {
SetUp()7     void SetUp() override {}
TearDown()8     void TearDown() override {}
9 };
10 
11 /**
12  * @tc.name: rand_001
13  * @tc.desc: This test verifies whether the random number returned by consecutive calls to the rand function after
14  *           setting the seed value to 0x01020304 using the srand function meets the expected value.
15  * @tc.type: FUNC
16  */
17 HWTEST_F(PrngRandTest, rand_001, TestSize.Level1)
18 {
19     srand(0x010203);
20     EXPECT_EQ(610060228, rand());
21     EXPECT_EQ(1081226626, rand());
22     EXPECT_EQ(612507619, rand());
23     EXPECT_EQ(1272242898, rand());
24 }