19 #include "gtest/gtest.h" 23 namespace strings_internal {
33 TEST(Pow10HelperTest, Works) {
39 constexpr TestCase kTestCases[] = {
45 {-319, 0x4f10, -1074},
46 {-318, 0x316a2, -1074},
47 {-317, 0x1ee257, -1074},
48 {-316, 0x134d761, -1074},
49 {-315, 0xc1069cd, -1074},
50 {-314, 0x78a42205, -1074},
51 {-313, 0x4b6695433, -1074},
52 {-312, 0x2f201d49fb, -1074},
53 {-311, 0x1d74124e3d1, -1074},
54 {-310, 0x12688b70e62b, -1074},
55 {-309, 0xb8157268fdaf, -1074},
56 {-308, 0x730d67819e8d2, -1074},
59 {-307, 0x11fa182c40c60d, -1072},
60 {-290, 0x18f2b061aea072, -1016},
61 {-276, 0x11BA03F5B21000, -969},
62 {-259, 0x1899C2F6732210, -913},
63 {-252, 0x1D53844EE47DD1, -890},
64 {-227, 0x1E5297287C2F45, -807},
65 {-198, 0x1322E220A5B17E, -710},
66 {-195, 0x12B010D3E1CF56, -700},
67 {-192, 0x123FF06EEA847A, -690},
68 {-163, 0x1708D0F84D3DE7, -594},
69 {-145, 0x13FAAC3E3FA1F3, -534},
70 {-111, 0x133D4032C2C7F5, -421},
71 {-106, 0x1D5B561574765B, -405},
72 {-104, 0x16EF5B40C2FC77, -398},
73 {-88, 0x197683DF2F268D, -345},
74 {-86, 0x13E497065CD61F, -338},
75 {-76, 0x17288E1271F513, -305},
76 {-63, 0x1A53FC9631D10D, -262},
77 {-30, 0x14484BFEEBC2A0, -152},
78 {-21, 0x12E3B40A0E9B4F, -122},
79 {-5, 0x14F8B588E368F1, -69},
80 {23, 0x152D02C7E14AF6, 24},
81 {29, 0x1431E0FAE6D721, 44},
82 {34, 0x1ED09BEAD87C03, 60},
83 {70, 0x172EBAD6DDC73D, 180},
84 {105, 0x1BE7ABD3781ECA, 296},
85 {126, 0x17A2ECC414A03F, 366},
86 {130, 0x1CDA62055B2D9E, 379},
87 {165, 0x115D847AD00087, 496},
88 {172, 0x14B378469B6732, 519},
89 {187, 0x1262DFEEBBB0F9, 569},
90 {210, 0x18557F31326BBB, 645},
91 {212, 0x1302CB5E6F642A, 652},
92 {215, 0x1290BA9A38C7D1, 662},
93 {236, 0x1F736F9B3494E9, 731},
94 {244, 0x176EC98994F489, 758},
95 {250, 0x1658E3AB795204, 778},
96 {252, 0x117571DDF6C814, 785},
97 {254, 0x1B4781EAD1989E, 791},
98 {260, 0x1A03FDE214CAF1, 811},
99 {284, 0x1585041B2C477F, 891},
100 {304, 0x1D2A1BE4048F90, 957},
109 for (
const TestCase& test_case : kTestCases) {
110 EXPECT_EQ(
Pow10(test_case.power),
111 std::ldexp(test_case.significand, test_case.radix))
113 Pow10(test_case.power),
114 std::ldexp(test_case.significand, test_case.radix));
ABSL_MUST_USE_RESULT std::string StrFormat(const FormatSpec< Args... > &format, const Args &...args)
TEST(BigUnsigned, ShiftLeft)