Lines Matching refs:TestUnit

17 class TestUnit final : public rtc_units_impl::RelativeUnit<TestUnit> {  class
19 TestUnit() = delete;
26 static constexpr TestUnit FromKilo(T kilo) { in FromKilo()
42 friend class rtc_units_impl::UnitBase<TestUnit>;
44 using RelativeUnit<TestUnit>::RelativeUnit;
46 constexpr TestUnit TestUnitAddKilo(TestUnit value, int add_kilo) { in TestUnitAddKilo()
47 value += TestUnit::FromKilo(add_kilo); in TestUnitAddKilo()
54 constexpr TestUnit kTestUnitZero = TestUnit::Zero(); in TEST()
55 constexpr TestUnit kTestUnitPlusInf = TestUnit::PlusInfinity(); in TEST()
56 constexpr TestUnit kTestUnitMinusInf = TestUnit::MinusInfinity(); in TEST()
64 constexpr TestUnit kTestUnitKilo = TestUnit::FromKilo(kValue); in TEST()
65 constexpr TestUnit kTestUnitValue = TestUnit::FromValue(kValue); in TEST()
77 EXPECT_EQ(TestUnit::FromKilo(value).ToKilo(), value); in TEST()
78 EXPECT_EQ(TestUnit::FromValue(value).ToValue<int64_t>(), value); in TEST()
80 EXPECT_EQ(TestUnit::Zero().ToValue<int64_t>(), 0); in TEST()
85 EXPECT_EQ(TestUnit::FromValue(kValue).ToKilo(), kValue / 1000); in TEST()
86 EXPECT_EQ(TestUnit::FromKilo(kValue).ToValue<int64_t>(), kValue * 1000); in TEST()
91 EXPECT_TRUE(TestUnit::Zero().IsZero()); in TEST()
92 EXPECT_FALSE(TestUnit::FromKilo(kValue).IsZero()); in TEST()
94 EXPECT_TRUE(TestUnit::PlusInfinity().IsInfinite()); in TEST()
95 EXPECT_TRUE(TestUnit::MinusInfinity().IsInfinite()); in TEST()
96 EXPECT_FALSE(TestUnit::Zero().IsInfinite()); in TEST()
97 EXPECT_FALSE(TestUnit::FromKilo(-kValue).IsInfinite()); in TEST()
98 EXPECT_FALSE(TestUnit::FromKilo(kValue).IsInfinite()); in TEST()
100 EXPECT_FALSE(TestUnit::PlusInfinity().IsFinite()); in TEST()
101 EXPECT_FALSE(TestUnit::MinusInfinity().IsFinite()); in TEST()
102 EXPECT_TRUE(TestUnit::FromKilo(-kValue).IsFinite()); in TEST()
103 EXPECT_TRUE(TestUnit::FromKilo(kValue).IsFinite()); in TEST()
104 EXPECT_TRUE(TestUnit::Zero().IsFinite()); in TEST()
106 EXPECT_TRUE(TestUnit::PlusInfinity().IsPlusInfinity()); in TEST()
107 EXPECT_FALSE(TestUnit::MinusInfinity().IsPlusInfinity()); in TEST()
109 EXPECT_TRUE(TestUnit::MinusInfinity().IsMinusInfinity()); in TEST()
110 EXPECT_FALSE(TestUnit::PlusInfinity().IsMinusInfinity()); in TEST()
116 const TestUnit small = TestUnit::FromKilo(kSmall); in TEST()
117 const TestUnit large = TestUnit::FromKilo(kLarge); in TEST()
119 EXPECT_EQ(TestUnit::Zero(), TestUnit::FromKilo(0)); in TEST()
120 EXPECT_EQ(TestUnit::PlusInfinity(), TestUnit::PlusInfinity()); in TEST()
121 EXPECT_EQ(small, TestUnit::FromKilo(kSmall)); in TEST()
122 EXPECT_LE(small, TestUnit::FromKilo(kSmall)); in TEST()
123 EXPECT_GE(small, TestUnit::FromKilo(kSmall)); in TEST()
124 EXPECT_NE(small, TestUnit::FromKilo(kLarge)); in TEST()
125 EXPECT_LE(small, TestUnit::FromKilo(kLarge)); in TEST()
126 EXPECT_LT(small, TestUnit::FromKilo(kLarge)); in TEST()
127 EXPECT_GE(large, TestUnit::FromKilo(kSmall)); in TEST()
128 EXPECT_GT(large, TestUnit::FromKilo(kSmall)); in TEST()
129 EXPECT_LT(TestUnit::Zero(), small); in TEST()
130 EXPECT_GT(TestUnit::Zero(), TestUnit::FromKilo(-kSmall)); in TEST()
131 EXPECT_GT(TestUnit::Zero(), TestUnit::FromKilo(-kSmall)); in TEST()
133 EXPECT_GT(TestUnit::PlusInfinity(), large); in TEST()
134 EXPECT_LT(TestUnit::MinusInfinity(), TestUnit::Zero()); in TEST()
138 const TestUnit upper = TestUnit::FromKilo(800); in TEST()
139 const TestUnit lower = TestUnit::FromKilo(100); in TEST()
140 const TestUnit under = TestUnit::FromKilo(100); in TEST()
141 const TestUnit inside = TestUnit::FromKilo(500); in TEST()
142 const TestUnit over = TestUnit::FromKilo(1000); in TEST()
147 TestUnit mutable_delta = lower; in TEST()
160 EXPECT_EQ(TestUnit::FromKilo(kMaxInt).ToValue<int64_t>(), in TEST()
170 EXPECT_EQ(TestUnit::FromValue(kValue).ToKilo<double>(), kKiloDouble); in TEST()
171 EXPECT_EQ(TestUnit::FromKilo(kKiloDouble).ToValue<int64_t>(), kValue); in TEST()
173 EXPECT_EQ(TestUnit::FromValue(kValue).ToValue<double>(), kValueDouble); in TEST()
174 EXPECT_EQ(TestUnit::FromValue(kValueDouble).ToValue<int64_t>(), kValue); in TEST()
176 EXPECT_NEAR(TestUnit::FromValue(kValue).ToMilli<double>(), kMilliDouble, 1); in TEST()
181 EXPECT_EQ(TestUnit::PlusInfinity().ToKilo<double>(), kPlusInfinity); in TEST()
182 EXPECT_EQ(TestUnit::MinusInfinity().ToKilo<double>(), kMinusInfinity); in TEST()
183 EXPECT_EQ(TestUnit::PlusInfinity().ToValue<double>(), kPlusInfinity); in TEST()
184 EXPECT_EQ(TestUnit::MinusInfinity().ToValue<double>(), kMinusInfinity); in TEST()
185 EXPECT_EQ(TestUnit::PlusInfinity().ToMilli<double>(), kPlusInfinity); in TEST()
186 EXPECT_EQ(TestUnit::MinusInfinity().ToMilli<double>(), kMinusInfinity); in TEST()
188 EXPECT_TRUE(TestUnit::FromKilo(kPlusInfinity).IsPlusInfinity()); in TEST()
189 EXPECT_TRUE(TestUnit::FromKilo(kMinusInfinity).IsMinusInfinity()); in TEST()
190 EXPECT_TRUE(TestUnit::FromValue(kPlusInfinity).IsPlusInfinity()); in TEST()
191 EXPECT_TRUE(TestUnit::FromValue(kMinusInfinity).IsMinusInfinity()); in TEST()
197 const TestUnit delta_a = TestUnit::FromKilo(kValueA); in TEST()
198 const TestUnit delta_b = TestUnit::FromKilo(kValueB); in TEST()
204 EXPECT_EQ((TestUnit::FromValue(kValueA) * kValueB).ToValue<int64_t>(), in TEST()
206 EXPECT_EQ((TestUnit::FromValue(kValueA) * kInt32Value).ToValue<int64_t>(), in TEST()
208 EXPECT_EQ((TestUnit::FromValue(kValueA) * kFloatValue).ToValue<int64_t>(), in TEST()
214 TestUnit mutable_delta = TestUnit::FromKilo(kValueA); in TEST()
215 mutable_delta += TestUnit::FromKilo(kValueB); in TEST()
216 EXPECT_EQ(mutable_delta, TestUnit::FromKilo(kValueA + kValueB)); in TEST()
217 mutable_delta -= TestUnit::FromKilo(kValueB); in TEST()
218 EXPECT_EQ(mutable_delta, TestUnit::FromKilo(kValueA)); in TEST()
223 const TestUnit finite = TestUnit::FromKilo(kValue); in TEST()
224 EXPECT_TRUE((TestUnit::PlusInfinity() + finite).IsPlusInfinity()); in TEST()
225 EXPECT_TRUE((TestUnit::PlusInfinity() - finite).IsPlusInfinity()); in TEST()
226 EXPECT_TRUE((finite + TestUnit::PlusInfinity()).IsPlusInfinity()); in TEST()
227 EXPECT_TRUE((finite - TestUnit::MinusInfinity()).IsPlusInfinity()); in TEST()
229 EXPECT_TRUE((TestUnit::MinusInfinity() + finite).IsMinusInfinity()); in TEST()
230 EXPECT_TRUE((TestUnit::MinusInfinity() - finite).IsMinusInfinity()); in TEST()
231 EXPECT_TRUE((finite + TestUnit::MinusInfinity()).IsMinusInfinity()); in TEST()
232 EXPECT_TRUE((finite - TestUnit::PlusInfinity()).IsMinusInfinity()); in TEST()