MCPcopy Create free account
hub / github.com/baidu/babylon / TEST_F

Function TEST_F

test/reusable/test_string.cpp:25–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23};
24
25TEST_F(ReusableStringTest, string_uses_allocator) {
26 {
27 auto s = allocator.create_object<SwissString>();
28 ASSERT_TRUE(s->empty());
29 ASSERT_TRUE(resource.contains(s));
30 }
31 {
32 auto s = allocator.create_object<SwissString>(1024, 'y');
33 ASSERT_EQ((::std::string(1024, 'y')), *s);
34 ASSERT_TRUE(resource.contains(s));
35 ASSERT_TRUE(resource.contains(s->c_str()));
36 }
37 {
38 auto s = allocator.create_object<SwissString>(long_string.c_str());
39 ASSERT_EQ(long_string, *s);
40 ASSERT_TRUE(resource.contains(s));
41 ASSERT_TRUE(resource.contains(s->c_str()));
42 }
43 {
44 auto s = allocator.create_object<SwissString>(long_string.c_str(), 512);
45 ASSERT_EQ(long_string.substr(0, 512), *s);
46 ASSERT_TRUE(resource.contains(s));
47 ASSERT_TRUE(resource.contains(s->c_str()));
48 }
49 {
50 auto s = allocator.create_object<SwissString>(long_string);
51 ASSERT_EQ(long_string, *s);
52 ASSERT_TRUE(resource.contains(s));
53 ASSERT_TRUE(resource.contains(s->c_str()));
54 }
55}
56
57TEST_F(ReusableStringTest, reusable) {
58 Reuse::AllocationMetadata<SwissString> meta;

Callers

nothing calls this directly

Calls 11

resize_uninitializedFunction · 0.85
substrMethod · 0.80
delete_objectMethod · 0.80
emptyMethod · 0.45
containsMethod · 0.45
resizeMethod · 0.45
capacityMethod · 0.45
destroyMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected