MCPcopy Create free account
hub / github.com/bytedance/bolt / TEST

Function TEST

bolt/type/tests/DecimalTest.cpp:93–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93TEST(DecimalTest, toString) {
94 EXPECT_EQ(std::to_string(HugeInt::build(0, 0)), "0");
95 EXPECT_EQ(std::to_string(HugeInt::build(0, 1)), "1");
96 EXPECT_EQ(
97 std::to_string(
98 HugeInt::build(0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull)),
99 "-1");
100 EXPECT_EQ(std::to_string(HugeInt::build(1, 0)), "18446744073709551616");
101 EXPECT_EQ(
102 std::to_string(HugeInt::build(0xFFFFFFFFFFFFFFFFull, 0)),
103 "-18446744073709551616");
104 constexpr int128_t kMax =
105 HugeInt::build(0x7FFFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull);
106 EXPECT_EQ(std::to_string(kMax), "170141183460469231731687303715884105727");
107 EXPECT_EQ(
108 std::to_string(-kMax - 1), "-170141183460469231731687303715884105728");
109}
110
111TEST(DecimalTest, decimalToString) {
112 ASSERT_EQ("1000", DecimalUtil::toString(1000, DECIMAL(10, 0)));

Callers

nothing calls this directly

Calls 15

buildFunction · 0.85
DECIMALFunction · 0.85
upperFunction · 0.85
lowerFunction · 0.85
testToByteArrayFunction · 0.85
zerosFunction · 0.85
lowestFunction · 0.85
lengthMethod · 0.80
adjustedSumMethod · 0.80
has_valueMethod · 0.80
to_stringFunction · 0.50
toStringFunction · 0.50

Tested by

no test coverage detected