summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Marcin Kowalczyk <qrczak@google.com>2022-12-01 09:37:19 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2022-12-01 09:38:15 -0800
commita23d720c30e2fff8dde9605bcabe39ce5b4069fc (patch)
tree7285e7aaefa9d6d4c2d530f126639482be6ae42f
parent296abbd35a600785d6297738749336061ecb2221 (diff)
Cosmetic reformatting in a test.
PiperOrigin-RevId: 492219541 Change-Id: Iee5d7941e413c8b960365e60fa0254536dd20e49
-rw-r--r--absl/numeric/BUILD.bazel1
-rw-r--r--absl/numeric/CMakeLists.txt1
-rw-r--r--absl/numeric/int128_stream_test.cc50
3 files changed, 24 insertions, 28 deletions
diff --git a/absl/numeric/BUILD.bazel b/absl/numeric/BUILD.bazel
index eaa27dfd..ec0b8701 100644
--- a/absl/numeric/BUILD.bazel
+++ b/absl/numeric/BUILD.bazel
@@ -95,7 +95,6 @@ cc_test(
deps = [
":int128",
"//absl/base",
- "//absl/base:core_headers",
"//absl/hash:hash_testing",
"//absl/meta:type_traits",
"@com_google_googletest//:gtest_main",
diff --git a/absl/numeric/CMakeLists.txt b/absl/numeric/CMakeLists.txt
index 26df5cf7..384c0fc0 100644
--- a/absl/numeric/CMakeLists.txt
+++ b/absl/numeric/CMakeLists.txt
@@ -70,7 +70,6 @@ absl_cc_test(
DEPS
absl::int128
absl::base
- absl::core_headers
absl::hash_testing
absl::type_traits
GTest::gmock_main
diff --git a/absl/numeric/int128_stream_test.cc b/absl/numeric/int128_stream_test.cc
index 479ad66c..81d2adee 100644
--- a/absl/numeric/int128_stream_test.cc
+++ b/absl/numeric/int128_stream_test.cc
@@ -76,16 +76,6 @@ std::string StreamFormatToString(std::ios_base::fmtflags flags,
return msg.str();
}
-void CheckUint128Case(const Uint128TestCase& test_case) {
- std::ostringstream os;
- os.flags(test_case.flags);
- os.width(test_case.width);
- os.fill(kFill);
- os << test_case.value;
- SCOPED_TRACE(StreamFormatToString(test_case.flags, test_case.width));
- EXPECT_EQ(test_case.expected, os.str());
-}
-
constexpr std::ios::fmtflags kDec = std::ios::dec;
constexpr std::ios::fmtflags kOct = std::ios::oct;
constexpr std::ios::fmtflags kHex = std::ios::hex;
@@ -96,6 +86,16 @@ constexpr std::ios::fmtflags kUpper = std::ios::uppercase;
constexpr std::ios::fmtflags kBase = std::ios::showbase;
constexpr std::ios::fmtflags kPos = std::ios::showpos;
+void CheckUint128Case(const Uint128TestCase& test_case) {
+ std::ostringstream os;
+ os.flags(test_case.flags);
+ os.width(test_case.width);
+ os.fill(kFill);
+ os << test_case.value;
+ SCOPED_TRACE(StreamFormatToString(test_case.flags, test_case.width));
+ EXPECT_EQ(os.str(), test_case.expected);
+}
+
TEST(Uint128, OStreamValueTest) {
CheckUint128Case({1, kDec, /*width = */ 0, "1"});
CheckUint128Case({1, kOct, /*width = */ 0, "1"});
@@ -161,7 +161,7 @@ void CheckInt128Case(const Int128TestCase& test_case) {
os.fill(kFill);
os << test_case.value;
SCOPED_TRACE(StreamFormatToString(test_case.flags, test_case.width));
- EXPECT_EQ(test_case.expected, os.str());
+ EXPECT_EQ(os.str(), test_case.expected);
}
TEST(Int128, OStreamValueTest) {
@@ -194,35 +194,33 @@ TEST(Int128, OStreamValueTest) {
{absl::MakeInt128(1, 0), kHex, /*width = */ 0, "10000000000000000"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::max(),
std::numeric_limits<uint64_t>::max()),
- std::ios::dec, /*width = */ 0,
+ kDec, /*width = */ 0,
"170141183460469231731687303715884105727"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::max(),
std::numeric_limits<uint64_t>::max()),
- std::ios::oct, /*width = */ 0,
+ kOct, /*width = */ 0,
"1777777777777777777777777777777777777777777"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::max(),
std::numeric_limits<uint64_t>::max()),
- std::ios::hex, /*width = */ 0,
- "7fffffffffffffffffffffffffffffff"});
+ kHex, /*width = */ 0, "7fffffffffffffffffffffffffffffff"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::min(), 0),
- std::ios::dec, /*width = */ 0,
+ kDec, /*width = */ 0,
"-170141183460469231731687303715884105728"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::min(), 0),
- std::ios::oct, /*width = */ 0,
+ kOct, /*width = */ 0,
"2000000000000000000000000000000000000000000"});
CheckInt128Case({absl::MakeInt128(std::numeric_limits<int64_t>::min(), 0),
- std::ios::hex, /*width = */ 0,
- "80000000000000000000000000000000"});
- CheckInt128Case({-1, std::ios::dec, /*width = */ 0, "-1"});
- CheckInt128Case({-1, std::ios::oct, /*width = */ 0,
+ kHex, /*width = */ 0, "80000000000000000000000000000000"});
+ CheckInt128Case({-1, kDec, /*width = */ 0, "-1"});
+ CheckInt128Case({-1, kOct, /*width = */ 0,
"3777777777777777777777777777777777777777777"});
CheckInt128Case(
- {-1, std::ios::hex, /*width = */ 0, "ffffffffffffffffffffffffffffffff"});
- CheckInt128Case({-12345, std::ios::dec, /*width = */ 0, "-12345"});
- CheckInt128Case({-12345, std::ios::oct, /*width = */ 0,
+ {-1, kHex, /*width = */ 0, "ffffffffffffffffffffffffffffffff"});
+ CheckInt128Case({-12345, kDec, /*width = */ 0, "-12345"});
+ CheckInt128Case({-12345, kOct, /*width = */ 0,
"3777777777777777777777777777777777777747707"});
- CheckInt128Case({-12345, std::ios::hex, /*width = */ 0,
- "ffffffffffffffffffffffffffffcfc7"});
+ CheckInt128Case(
+ {-12345, kHex, /*width = */ 0, "ffffffffffffffffffffffffffffcfc7"});
}
std::vector<Int128TestCase> GetInt128FormatCases();