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

Function TEST

be/src/runtime/string-buffer-test.cc:37–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37TEST(StringBufferTest, Basic) {
38 MemTracker tracker;
39 MemPool pool(&tracker);
40 StringBuffer str(&pool);
41 string std_str;
42
43 // Empty string
44 ValidateString(std_str, str);
45
46 // Clear empty string
47 std_str.clear();
48 str.Clear();
49 ValidateString(std_str, str);
50
51 // Append to empty
52 std_str.append("Hello");
53 ASSERT_OK(str.Append("Hello", strlen("Hello")));
54 ValidateString(std_str, str);
55
56 // Append some more
57 std_str.append("World");
58 ASSERT_OK(str.Append("World", strlen("World")));
59 ValidateString(std_str, str);
60
61 // Clear
62 std_str.clear();
63 str.Clear();
64 ValidateString(std_str, str);
65
66 // Underlying buffer size should be the length of the max string during the test.
67 EXPECT_EQ(str.buffer_size(), strlen("HelloWorld"));
68
69 pool.FreeAll();
70}
71
72TEST(StringBufferTest, AppendBoundary) {
73 // Test StringBuffer::Append() works beyond 1GB.

Callers

nothing calls this directly

Calls 8

ValidateStringFunction · 0.85
buffer_sizeMethod · 0.80
resizeMethod · 0.80
clearMethod · 0.65
ClearMethod · 0.45
appendMethod · 0.45
AppendMethod · 0.45
FreeAllMethod · 0.45

Tested by

no test coverage detected