@@ -26,7 +26,7 @@ TEST_CASE("StringBuilder") {
26
26
REQUIRE (spyingAllocator.log () == AllocatorLog{
27
27
Allocate (sizeofStringBuffer ()),
28
28
});
29
- REQUIRE (data.type () == VariantType::TinyString);
29
+ REQUIRE (data.type == VariantType::TinyString);
30
30
}
31
31
32
32
SECTION (" Tiny string" ) {
@@ -45,8 +45,8 @@ TEST_CASE("StringBuilder") {
45
45
str.save (&data);
46
46
47
47
REQUIRE (resources.overflowed () == false );
48
- REQUIRE (data.type () == VariantType::TinyString);
49
- REQUIRE (data.asString (&resources ) == " url" );
48
+ REQUIRE (data.type == VariantType::TinyString);
49
+ REQUIRE (VariantImpl (& data, &resources) .asString () == " url" );
50
50
}
51
51
52
52
SECTION (" Short string fits in first allocation" ) {
@@ -134,10 +134,10 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
134
134
auto s2 = saveString (builder, " world" );
135
135
auto s3 = saveString (builder, " hello" );
136
136
137
- REQUIRE (s1 .asString (&resources ) == " hello" );
138
- REQUIRE (s2 .asString (&resources ) == " world" );
139
- REQUIRE (+s1 .asString (&resources ).c_str () ==
140
- +s3 .asString (&resources ).c_str ()); // same address
137
+ REQUIRE (VariantImpl (&s1, &resources) .asString () == " hello" );
138
+ REQUIRE (VariantImpl (&s2, &resources) .asString () == " world" );
139
+ REQUIRE (+VariantImpl (&s1, &resources) .asString ().c_str () ==
140
+ +VariantImpl (&s3, &resources) .asString ().c_str ()); // same address
141
141
142
142
REQUIRE (spy.log () ==
143
143
AllocatorLog{
@@ -153,10 +153,11 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
153
153
auto s1 = saveString (builder, " hello world" );
154
154
auto s2 = saveString (builder, " hello" );
155
155
156
- REQUIRE (s1.asString (&resources) == " hello world" );
157
- REQUIRE (s2.asString (&resources) == " hello" );
158
- REQUIRE (+s2.asString (&resources).c_str () !=
159
- +s1.asString (&resources).c_str ()); // different address
156
+ REQUIRE (VariantImpl (&s1, &resources).asString () == " hello world" );
157
+ REQUIRE (VariantImpl (&s2, &resources).asString () == " hello" );
158
+ REQUIRE (
159
+ +VariantImpl (&s1, &resources).asString ().c_str () !=
160
+ +VariantImpl (&s2, &resources).asString ().c_str ()); // different address
160
161
161
162
REQUIRE (spy.log () ==
162
163
AllocatorLog{
@@ -171,10 +172,11 @@ TEST_CASE("StringBuilder::save() deduplicates strings") {
171
172
auto s1 = saveString (builder, " hello world" );
172
173
auto s2 = saveString (builder, " worl" );
173
174
174
- REQUIRE (s1.asString (&resources) == " hello world" );
175
- REQUIRE (s2.asString (&resources) == " worl" );
176
- REQUIRE (s2.asString (&resources).c_str () !=
177
- s1.asString (&resources).c_str ()); // different address
175
+ REQUIRE (VariantImpl (&s1, &resources).asString () == " hello world" );
176
+ REQUIRE (VariantImpl (&s2, &resources).asString () == " worl" );
177
+ REQUIRE (
178
+ VariantImpl (&s1, &resources).asString ().c_str () !=
179
+ VariantImpl (&s2, &resources).asString ().c_str ()); // different address
178
180
179
181
REQUIRE (spy.log () ==
180
182
AllocatorLog{
0 commit comments