88#include " Allocators.hpp"
99#include " Literals.hpp"
1010
11- using ArduinoJson::detail::sizeofObject ;
11+ using namespace ArduinoJson ::detail;
1212
1313enum ErrorCode { ERROR_01 = 1 , ERROR_10 = 10 };
1414
@@ -197,11 +197,11 @@ TEST_CASE("JsonVariant::set() when there is enough memory") {
197197 REQUIRE (result == true );
198198 REQUIRE (variant.is <double >() == true );
199199 REQUIRE (variant.as <double >() == 1.2 );
200- REQUIRE (spy.log () ==
201- AllocatorLog{
202- Allocate (sizeofPool () ),
203- Reallocate ( sizeofPool (), sizeofPool (1 )), // one extension slot
204- });
200+ REQUIRE (spy.log () == AllocatorLog{
201+ Allocate (sizeofPool<EightByteValue>()),
202+ Reallocate (sizeofPool<EightByteValue>( ),
203+ sizeofPool<EightByteValue> (1 )),
204+ });
205205 }
206206
207207 SECTION (" int32_t" ) {
@@ -220,11 +220,11 @@ TEST_CASE("JsonVariant::set() when there is enough memory") {
220220 REQUIRE (result == true );
221221 REQUIRE (variant.is <int64_t >() == true );
222222 REQUIRE (variant.as <int64_t >() == -2147483649LL );
223- REQUIRE (spy.log () ==
224- AllocatorLog{
225- Allocate (sizeofPool () ),
226- Reallocate ( sizeofPool (), sizeofPool (1 )), // one extension slot
227- });
223+ REQUIRE (spy.log () == AllocatorLog{
224+ Allocate (sizeofPool<EightByteValue>()),
225+ Reallocate (sizeofPool<EightByteValue>( ),
226+ sizeofPool<EightByteValue> (1 )),
227+ });
228228 }
229229
230230 SECTION (" uint32_t" ) {
@@ -243,11 +243,11 @@ TEST_CASE("JsonVariant::set() when there is enough memory") {
243243 REQUIRE (result == true );
244244 REQUIRE (variant.is <uint64_t >() == true );
245245 REQUIRE (variant.as <uint64_t >() == 4294967296 );
246- REQUIRE (spy.log () ==
247- AllocatorLog{
248- Allocate (sizeofPool () ),
249- Reallocate ( sizeofPool (), sizeofPool (1 )), // one extension slot
250- });
246+ REQUIRE (spy.log () == AllocatorLog{
247+ Allocate (sizeofPool<EightByteValue>()),
248+ Reallocate (sizeofPool<EightByteValue>( ),
249+ sizeofPool<EightByteValue> (1 )),
250+ });
251251 }
252252
253253 SECTION (" JsonDocument" ) {
@@ -378,7 +378,7 @@ TEST_CASE("JsonVariant::set() releases the previous value") {
378378 }
379379
380380 SECTION (" float" ) {
381- v.set (1.2 );
381+ v.set (1 .2f );
382382 REQUIRE (spy.log () == AllocatorLog{
383383 Deallocate (sizeofString (" world" )),
384384 });
@@ -393,7 +393,7 @@ TEST_CASE("JsonVariant::set() releases the previous value") {
393393 }
394394}
395395
396- TEST_CASE (" JsonVariant::set() reuses extension slot" ) {
396+ TEST_CASE (" JsonVariant::set() reuses 8-bit slot" ) {
397397 SpyingAllocator spy;
398398 JsonDocument doc (&spy);
399399 JsonVariant variant = doc.to <JsonVariant>();
0 commit comments