OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/test_tools/quic_test_utils.h" | 5 #include "net/quic/test_tools/quic_test_utils.h" |
6 | 6 |
7 #include "testing/gtest/include/gtest/gtest-spi.h" | 7 #include "testing/gtest/include/gtest/gtest-spi.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace net { | 10 namespace net { |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 TEST(QuicTestUtilsTest, QuicBandwidth) { | 31 TEST(QuicTestUtilsTest, QuicBandwidth) { |
32 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), | 32 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), |
33 QuicBandwidth::FromBitsPerSecond(8005), 0.01f); | 33 QuicBandwidth::FromBitsPerSecond(8005), 0.01f); |
34 EXPECT_NONFATAL_FAILURE( | 34 EXPECT_NONFATAL_FAILURE( |
35 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), | 35 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), |
36 QuicBandwidth::FromBitsPerSecond(9005), 0.01f), | 36 QuicBandwidth::FromBitsPerSecond(9005), 0.01f), |
37 ""); | 37 ""); |
38 } | 38 } |
39 | 39 |
| 40 // Ensure that SimpleRandom does not change its output for a fixed seed. |
| 41 TEST(QuicTestUtilsTest, SimpleRandomStability) { |
| 42 SimpleRandom rng; |
| 43 rng.set_seed(UINT64_C(0x1234567800010001)); |
| 44 EXPECT_EQ(UINT64_C(14865409841904857791), rng.RandUint64()); |
| 45 EXPECT_EQ(UINT64_C(12139094019410129741), rng.RandUint64()); |
| 46 } |
| 47 |
40 } // namespace test | 48 } // namespace test |
41 } // namespace net | 49 } // namespace net |
OLD | NEW |