Adds arithmetic support to DataRate.
Bug: webrtc:9709 Change-Id: Id3fde2b7bbc63c6372cadc76b92c4568665b17f9 Reviewed-on: https://webrtc-review.googlesource.com/97702 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#24562}
This commit is contained in:
committed by
Commit Bot
parent
96816753d9
commit
af21eab531
@ -100,11 +100,21 @@ TEST(DataRateTest, MathOperations) {
|
||||
const DataRate rate_b = DataRate::bps(kValueB);
|
||||
const int32_t kInt32Value = 123;
|
||||
const double kFloatValue = 123.0;
|
||||
|
||||
EXPECT_EQ((rate_a + rate_b).bps(), kValueA + kValueB);
|
||||
EXPECT_EQ((rate_a - rate_b).bps(), kValueA - kValueB);
|
||||
|
||||
EXPECT_EQ((rate_a * kValueB).bps(), kValueA * kValueB);
|
||||
EXPECT_EQ((rate_a * kInt32Value).bps(), kValueA * kInt32Value);
|
||||
EXPECT_EQ((rate_a * kFloatValue).bps(), kValueA * kFloatValue);
|
||||
|
||||
EXPECT_EQ(rate_a / rate_b, static_cast<double>(kValueA) / kValueB);
|
||||
|
||||
DataRate mutable_rate = DataRate::bps(kValueA);
|
||||
mutable_rate += rate_b;
|
||||
EXPECT_EQ(mutable_rate.bps(), kValueA + kValueB);
|
||||
mutable_rate -= rate_a;
|
||||
EXPECT_EQ(mutable_rate.bps(), kValueB);
|
||||
}
|
||||
|
||||
TEST(UnitConversionTest, DataRateAndDataSizeAndTimeDelta) {
|
||||
|
||||
Reference in New Issue
Block a user