about summary refs log tree commit diff
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.cc11
1 files changed, 11 insertions, 0 deletions
diff --git a/absl/numeric/int128_test.cc b/absl/numeric/int128_test.cc
index 79bcca907ae9..1eb3e0ec8961 100644
--- a/absl/numeric/int128_test.cc
+++ b/absl/numeric/int128_test.cc
@@ -428,4 +428,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