OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "net/quic/test_tools/quic_test_utils.h" |
| 6 |
| 7 #include "testing/gtest/include/gtest/gtest-spi.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace net { |
| 11 namespace test { |
| 12 |
| 13 TEST(QuicTestUtilsTest, BasicApproxEq) { |
| 14 ExpectApproxEq(10, 10, 1e-6f); |
| 15 ExpectApproxEq(1000, 1001, 0.01f); |
| 16 EXPECT_NONFATAL_FAILURE(ExpectApproxEq(1000, 1100, 0.01f), ""); |
| 17 |
| 18 ExpectApproxEq(64, 31, 0.55f); |
| 19 EXPECT_NONFATAL_FAILURE(ExpectApproxEq(31, 64, 0.55f), ""); |
| 20 } |
| 21 |
| 22 TEST(QuicTestUtilsTest, QuicTimeDelta) { |
| 23 ExpectApproxEq(QuicTime::Delta::FromMicroseconds(1000), |
| 24 QuicTime::Delta::FromMicroseconds(1003), 0.01f); |
| 25 EXPECT_NONFATAL_FAILURE( |
| 26 ExpectApproxEq(QuicTime::Delta::FromMicroseconds(1000), |
| 27 QuicTime::Delta::FromMicroseconds(1200), 0.01f), |
| 28 ""); |
| 29 } |
| 30 |
| 31 TEST(QuicTestUtilsTest, QuicBandwidth) { |
| 32 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), |
| 33 QuicBandwidth::FromBitsPerSecond(8005), 0.01f); |
| 34 EXPECT_NONFATAL_FAILURE( |
| 35 ExpectApproxEq(QuicBandwidth::FromBytesPerSecond(1000), |
| 36 QuicBandwidth::FromBitsPerSecond(9005), 0.01f), |
| 37 ""); |
| 38 } |
| 39 |
| 40 } // namespace test |
| 41 } // namespace net |
OLD | NEW |