Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: net/quic/test_tools/quic_test_utils_test.cc

Issue 2336913006: Introduce ExpectApproxEq, a helper function that allows making assertions that certain values are e… (Closed)
Patch Set: Fix MSVC warnings Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698