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

Unified Diff: net/quic/core/quic_bandwidth_test.cc

Issue 2309603002: Round results of multiplying QuicBandwidth and QuicTime::Delta rather than truncating. No behavior… (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_bandwidth.h ('k') | net/quic/core/quic_time.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_bandwidth_test.cc
diff --git a/net/quic/core/quic_bandwidth_test.cc b/net/quic/core/quic_bandwidth_test.cc
index 78fac500581437024bb449a91e5317f20ea32370..31f755b69c19f8f74d2c5bef8e4c93c4655a8678 100644
--- a/net/quic/core/quic_bandwidth_test.cc
+++ b/net/quic/core/quic_bandwidth_test.cc
@@ -63,6 +63,12 @@ TEST_F(QuicBandwidthTest, Scale) {
0.75f * QuicBandwidth::FromKBytesPerSecond(1000));
EXPECT_EQ(QuicBandwidth::FromKBytesPerSecond(1250),
QuicBandwidth::FromKBytesPerSecond(1000) * 1.25f);
+
+ // Ensure we are rounding correctly within a 1bps level of precision.
+ EXPECT_EQ(QuicBandwidth::FromBitsPerSecond(5),
+ QuicBandwidth::FromBitsPerSecond(9) * 0.5);
+ EXPECT_EQ(QuicBandwidth::FromBitsPerSecond(2),
+ QuicBandwidth::FromBitsPerSecond(12) * 0.2);
}
TEST_F(QuicBandwidthTest, BytesPerPeriod) {
« no previous file with comments | « net/quic/core/quic_bandwidth.h ('k') | net/quic/core/quic_time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698