| 23 | }; |
| 24 | |
| 25 | TEST_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 | |
| 57 | TEST_F(ReusableStringTest, reusable) { |
| 58 | Reuse::AllocationMetadata<SwissString> meta; |
nothing calls this directly
no test coverage detected