summaryrefslogtreecommitdiff
path: root/absl/numeric/int128_test.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/numeric/int128_test.cc')
-rw-r--r--absl/numeric/int128_test.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/absl/numeric/int128_test.cc b/absl/numeric/int128_test.cc
index 79bcca90..dfe3475a 100644
--- a/absl/numeric/int128_test.cc
+++ b/absl/numeric/int128_test.cc
@@ -23,6 +23,7 @@
#include "gtest/gtest.h"
#include "absl/base/internal/cycleclock.h"
+#include "absl/hash/hash_testing.h"
#include "absl/meta/type_traits.h"
#if defined(_MSC_VER) && _MSC_VER == 1900
@@ -428,4 +429,15 @@ TEST(Uint128, ConstexprTest) {
EXPECT_EQ(minus_two, absl::MakeUint128(-1, -2));
}
+TEST(Uint128, NumericLimitsTest) {
+ static_assert(std::numeric_limits<absl::uint128>::is_specialized, "");
+ static_assert(!std::numeric_limits<absl::uint128>::is_signed, "");
+ static_assert(std::numeric_limits<absl::uint128>::is_integer, "");
+ EXPECT_EQ(static_cast<int>(128 * std::log10(2)),
+ std::numeric_limits<absl::uint128>::digits10);
+ EXPECT_EQ(0, std::numeric_limits<absl::uint128>::min());
+ EXPECT_EQ(0, std::numeric_limits<absl::uint128>::lowest());
+ EXPECT_EQ(absl::Uint128Max(), std::numeric_limits<absl::uint128>::max());
+}
+
} // namespace