MCPcopy Create free account
hub / github.com/apache/impala / TEST

Function TEST

be/src/util/string-parser-test.cc:172–197  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172TEST(StringToInt, Basic) {
173 TestIntValue<int8_t>("123", 123, StringParser::PARSE_SUCCESS);
174 TestIntValue<int16_t>("123", 123, StringParser::PARSE_SUCCESS);
175 TestIntValue<int32_t>("123", 123, StringParser::PARSE_SUCCESS);
176 TestIntValue<int64_t>("123", 123, StringParser::PARSE_SUCCESS);
177
178 TestIntValue<int8_t>("123", 123, StringParser::PARSE_SUCCESS);
179 TestIntValue<int16_t>("12345", 12345, StringParser::PARSE_SUCCESS);
180 TestIntValue<int32_t>("12345678", 12345678, StringParser::PARSE_SUCCESS);
181 TestIntValue<int64_t>("12345678901234", 12345678901234, StringParser::PARSE_SUCCESS);
182
183 TestIntValue<int8_t>("-10", -10, StringParser::PARSE_SUCCESS);
184 TestIntValue<int16_t>("-10", -10, StringParser::PARSE_SUCCESS);
185 TestIntValue<int32_t>("-10", -10, StringParser::PARSE_SUCCESS);
186 TestIntValue<int64_t>("-10", -10, StringParser::PARSE_SUCCESS);
187
188 TestIntValue<int8_t>("+1", 1, StringParser::PARSE_SUCCESS);
189 TestIntValue<int16_t>("+1", 1, StringParser::PARSE_SUCCESS);
190 TestIntValue<int32_t>("+1", 1, StringParser::PARSE_SUCCESS);
191 TestIntValue<int64_t>("+1", 1, StringParser::PARSE_SUCCESS);
192
193 TestIntValue<int8_t>("+0", 0, StringParser::PARSE_SUCCESS);
194 TestIntValue<int16_t>("-0", 0, StringParser::PARSE_SUCCESS);
195 TestIntValue<int32_t>("+0", 0, StringParser::PARSE_SUCCESS);
196 TestIntValue<int64_t>("-0", 0, StringParser::PARSE_SUCCESS);
197}
198
199TEST(StringToInt, InvalidLeadingTrailing) {
200 // Test that trailing garbage is not allowed.

Callers

nothing calls this directly

Calls 7

maxFunction · 0.85
minFunction · 0.85
TestAllFloatVariantsFunction · 0.85
TestBoolValueFunction · 0.85
TestDateValueFunction · 0.85
DateValueClass · 0.50

Tested by

no test coverage detected