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

Function TestAllFloatVariants

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

Tests conversion of s to double and float with +/- prefixing (and no prefix) and with and without leading/trailing whitespace

Source from the content-addressed store, hash-verified

120// Tests conversion of s to double and float with +/- prefixing (and no prefix) and with
121// and without leading/trailing whitespace
122void TestAllFloatVariants(const string& s, StringParser::ParseResult exp_result) {
123 string sign[] = {"", "+", "-"};
124 for (int i = 0; i < space_len; ++i) {
125 for (int j = 0; j < space_len; ++j) {
126 for (int k = 0; k < 3; ++k) {
127 // All combinations of leading and/or trailing whitespace and +/- sign.
128 string str = space[i] + sign[k] + s + space[j];
129 TestFloatValue<float>(str, exp_result);
130 TestFloatValue<double>(str, exp_result);
131 }
132 }
133 }
134}
135
136template<typename T>
137void TestFloatBruteForce() {

Callers 1

TESTFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected