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

Unified Diff: webrtc/rtc_base/mod_ops_unittest.cc

Issue 2977603002: Implemented a new sequence number unwrapper in sequence_number_util.h. (Closed)
Patch Set: Feedback Created 3 years, 5 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 | « webrtc/rtc_base/mod_ops.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/rtc_base/mod_ops_unittest.cc
diff --git a/webrtc/rtc_base/mod_ops_unittest.cc b/webrtc/rtc_base/mod_ops_unittest.cc
index c375305e2d3c15e1821f342c5a701db0dc5b6c23..d39ea061b6f5724af88e055641b6d1bf249f3155 100644
--- a/webrtc/rtc_base/mod_ops_unittest.cc
+++ b/webrtc/rtc_base/mod_ops_unittest.cc
@@ -87,6 +87,14 @@ TEST_F(TestModOps, ForwardDiff) {
}
}
+TEST_F(TestModOps, ForwardDiffWithDivisor) {
+ ASSERT_EQ(122, (ForwardDiff<uint8_t, 123>(0, 122)));
+ ASSERT_EQ(0, (ForwardDiff<uint8_t, 123>(122, 122)));
+ ASSERT_EQ(122, (ForwardDiff<uint8_t, 123>(1, 0)));
+ ASSERT_EQ(0, (ForwardDiff<uint8_t, 123>(0, 0)));
+ ASSERT_EQ(1, (ForwardDiff<uint8_t, 123>(122, 0)));
+}
+
TEST_F(TestModOps, ReverseDiff) {
ASSERT_EQ(0u, ReverseDiff(4711u, 4711u));
@@ -106,6 +114,14 @@ TEST_F(TestModOps, ReverseDiff) {
}
}
+TEST_F(TestModOps, ReverseDiffWithDivisor) {
+ ASSERT_EQ(1, (ReverseDiff<uint8_t, 123>(0, 122)));
+ ASSERT_EQ(0, (ReverseDiff<uint8_t, 123>(122, 122)));
+ ASSERT_EQ(1, (ReverseDiff<uint8_t, 123>(1, 0)));
+ ASSERT_EQ(0, (ReverseDiff<uint8_t, 123>(0, 0)));
+ ASSERT_EQ(122, (ReverseDiff<uint8_t, 123>(122, 0)));
+}
+
TEST_F(TestModOps, MinDiff) {
for (uint16_t i = 0; i < 256; ++i) {
ASSERT_EQ(0, MinDiff<uint8_t>(i, i));
« no previous file with comments | « webrtc/rtc_base/mod_ops.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698