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

Function TestDateTokenPermutations

be/src/runtime/date-test.cc:171–184  ·  view source on GitHub ↗

This function will generate all permutations of tokens to test that the parsing and formatting is correct (position of tokens should be irrelevant). Note that separators are also combined with EACH token permutation to get the widest coverage on formats. This forces out the parsing and format logic edge cases.

Source from the content-addressed store, hash-verified

169// are also combined with EACH token permutation to get the widest coverage on formats.
170// This forces out the parsing and format logic edge cases.
171void TestDateTokenPermutations(vector<DateToken>* toks, int year, int month, int day) {
172 sort(toks->begin(), toks->end());
173
174 const char* SEPARATORS = " ~!@%^&*_+-:;|\\,./";
175 do {
176 // Validate we can parse date raw tokens (no separators)
177 TestDateTokens(*toks, year, month, day, nullptr);
178
179 // Validate we can parse date with separators
180 for (const char* separator = SEPARATORS; *separator != 0; ++separator) {
181 TestDateTokens(*toks, year, month, day, separator);
182 }
183 } while (next_permutation(toks->begin(), toks->end()));
184}
185
186TEST(DateTest, ParseFormatCustomFormats) {
187 // Test custom formats by generating all permutations of tokens to check parsing and

Callers 1

TESTFunction · 0.85

Calls 4

sortFunction · 0.85
TestDateTokensFunction · 0.85
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected