webrtc/net/dcsctp/common/math_test.cc
Victor Boivie a4d5e24c11 dcsctp: Added common utilities
These are quite generic utilities that are used by multiple modules
within dcSCTP. Some would be good to have in rtc_base and are simple
replicas of utilities available in abseil.

Bug: webrtc:12614
Change-Id: I9914286ced7317a34628a71697da9149d6d19d38
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/213190
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33609}
2021-04-01 05:45:34 +00:00

32 lines
966 B
C++

/*
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "net/dcsctp/common/math.h"
#include "test/gmock.h"
namespace dcsctp {
namespace {
TEST(MathUtilTest, CanRoundUpTo4) {
EXPECT_EQ(RoundUpTo4(0), 0);
EXPECT_EQ(RoundUpTo4(1), 4);
EXPECT_EQ(RoundUpTo4(2), 4);
EXPECT_EQ(RoundUpTo4(3), 4);
EXPECT_EQ(RoundUpTo4(4), 4);
EXPECT_EQ(RoundUpTo4(5), 8);
EXPECT_EQ(RoundUpTo4(6), 8);
EXPECT_EQ(RoundUpTo4(7), 8);
EXPECT_EQ(RoundUpTo4(8), 8);
EXPECT_EQ(RoundUpTo4(10000000000), 10000000000);
EXPECT_EQ(RoundUpTo4(10000000001), 10000000004);
}
} // namespace
} // namespace dcsctp