mirror of
https://github.com/fmtlib/fmt.git
synced 2025-10-28 04:31:44 +01:00
Implement 128-bit operator+= for uint128_fallback
This commit is contained in:
@@ -33,6 +33,7 @@ using fmt::memory_buffer;
|
||||
using fmt::runtime;
|
||||
using fmt::string_view;
|
||||
using fmt::detail::max_value;
|
||||
using fmt::detail::uint128_fallback;
|
||||
|
||||
using testing::Return;
|
||||
using testing::StrictMock;
|
||||
@@ -40,7 +41,6 @@ using testing::StrictMock;
|
||||
enum { buffer_size = 256 };
|
||||
|
||||
TEST(uint128_test, ctor) {
|
||||
using fmt::detail::uint128_fallback;
|
||||
auto n = uint128_fallback();
|
||||
EXPECT_EQ(n, 0);
|
||||
n = uint128_fallback(42);
|
||||
@@ -49,7 +49,7 @@ TEST(uint128_test, ctor) {
|
||||
}
|
||||
|
||||
TEST(uint128_test, shift) {
|
||||
auto n = fmt::detail::uint128_fallback(42);
|
||||
auto n = uint128_fallback(42);
|
||||
n = n << 64;
|
||||
EXPECT_EQ(static_cast<uint64_t>(n), 0);
|
||||
n = n >> 64;
|
||||
@@ -62,10 +62,19 @@ TEST(uint128_test, shift) {
|
||||
}
|
||||
|
||||
TEST(uint128_test, minus) {
|
||||
auto n = fmt::detail::uint128_fallback(42);
|
||||
auto n = uint128_fallback(42);
|
||||
EXPECT_EQ(n - 2, 40);
|
||||
}
|
||||
|
||||
TEST(uint128_test, plus_assign) {
|
||||
auto n = uint128_fallback(32);
|
||||
n += uint128_fallback(10);
|
||||
EXPECT_EQ(n, 42);
|
||||
n = uint128_fallback(max_value<uint64_t>());
|
||||
n += uint128_fallback(1);
|
||||
EXPECT_EQ(n, uint128_fallback(1) << 64);
|
||||
}
|
||||
|
||||
template <typename Float> void check_isfinite() {
|
||||
using fmt::detail::isfinite;
|
||||
EXPECT_TRUE(isfinite(Float(0.0)));
|
||||
|
||||
Reference in New Issue
Block a user