MCPcopy Create free account
hub / github.com/apache/arrow / TestSmallValues

Method TestSmallValues

cpp/src/arrow/util/decimal_test.cc:166–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

164 }
165
166 void TestSmallValues() {
167 struct TestValue {
168 std::string s;
169 int64_t expected;
170 int32_t expected_precision;
171 int32_t expected_scale;
172 };
173 for (const auto& tv : std::vector<TestValue>{{"12.3", 123LL, 3, 1},
174 {"0.00123", 123LL, 5, 5},
175 {"1.23E-8", 123LL, 3, 10},
176 {"-1.23E-8", -123LL, 3, 10},
177 {"1.23E+3", 1230LL, 4, 0},
178 {"-1.23E+3", -1230LL, 4, 0},
179 {"1.23E+5", 123000LL, 6, 0},
180 {"1.2345E+7", 12345000LL, 8, 0},
181 {"1.23e-8", 123LL, 3, 10},
182 {"-1.23e-8", -123LL, 3, 10},
183 {"1.23e+3", 1230LL, 4, 0},
184 {"-1.23e+3", -1230LL, 4, 0},
185 {"1.23e+5", 123000LL, 6, 0},
186 {"1.2345e+7", 12345000LL, 8, 0}}) {
187 ARROW_SCOPED_TRACE("s = '", tv.s, "'");
188 AssertDecimalFromString(tv.s, DecimalType(tv.expected), tv.expected_precision,
189 tv.expected_scale);
190 }
191 }
192
193 void CheckRandomValuesRoundTrip(int32_t precision, int32_t scale) {
194 auto rnd = random::RandomArrayGenerator(42);

Callers 1

TYPED_TESTFunction · 0.80

Calls 2

AssertDecimalFromStringFunction · 0.85
DecimalTypeClass · 0.50

Tested by

no test coverage detected