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

Function RunTestCase

be/src/runtime/string-compare-test.cc:29–40  ·  view source on GitHub ↗

Expect that strncmp() and StringCompare() return the same result.

Source from the content-addressed store, hash-verified

27
28// Expect that strncmp() and StringCompare() return the same result.
29static void RunTestCase(const string& l, const string& r) {
30 int cmp_len = ::min(l.size(), r.size());
31 int strncmp_r = strncmp(l.c_str(), r.c_str(), cmp_len);
32 int stringcompare_r = StringCompare(l.c_str(), l.size(), r.c_str(), r.size(), cmp_len);
33 if (strncmp_r == 0) {
34 EXPECT_EQ(stringcompare_r, 0) << l << " " << r;
35 } else if (strncmp_r > 0) {
36 EXPECT_GT(stringcompare_r, 0) << l << " " << r;
37 } else {
38 EXPECT_LT(stringcompare_r, 0) << l << " " << r;
39 }
40}
41
42TEST(StringCompareTest, Basic) {
43 const struct Cases {

Callers 1

TESTFunction · 0.85

Calls 3

minFunction · 0.85
StringCompareFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected