Skip to content

Commit

Permalink
Unreviewed, adjust JSONValues memoryCost function for debug build (be…
Browse files Browse the repository at this point in the history
…cause of RefCounted's additional fields)

https://bugs.webkit.org/show_bug.cgi?id=259919
rdar://113545689

* Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/266679@main
  • Loading branch information
Constellation committed Aug 8, 2023
1 parent d9b63e8 commit 70e3b43
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions Tools/TestWebKitAPI/Tests/WTF/JSONValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,38 +672,38 @@ TEST(JSONValue, MemoryCost)
Ref<JSON::Value> value = JSON::Value::null();
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 16U);
EXPECT_LE(memoryCost, 24U);
}

{
Ref<JSON::Value> value = JSON::Value::create(true);
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 16U);
EXPECT_LE(memoryCost, 24U);
}

{
Ref<JSON::Value> value = JSON::Value::create(1.0);
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 16U);
EXPECT_LE(memoryCost, 24U);
}

{
Ref<JSON::Value> value = JSON::Value::create(1);
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 16U);
EXPECT_LE(memoryCost, 24U);
}

{
Ref<JSON::Value> value = JSON::Value::create(makeString("test"_s));
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
#if HAVE(36BIT_ADDRESS)
EXPECT_LE(memoryCost, 52U);
EXPECT_LE(memoryCost, 60U);
#else
EXPECT_LE(memoryCost, 44U);
EXPECT_LE(memoryCost, 52U);
#endif
}

Expand All @@ -712,17 +712,17 @@ TEST(JSONValue, MemoryCost)
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
#if HAVE(36BIT_ADDRESS)
EXPECT_LE(memoryCost, 48U);
EXPECT_LE(memoryCost, 56U);
#else
EXPECT_LE(memoryCost, 40U);
EXPECT_LE(memoryCost, 48U);
#endif
}

{
Ref<JSON::Value> value = JSON::Value::create(String());
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 16U);
EXPECT_LE(memoryCost, 24U);
}

{
Expand All @@ -746,14 +746,14 @@ TEST(JSONValue, MemoryCost)
value->setValue("test"_s, JSON::Value::null());
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 60U);
EXPECT_LE(memoryCost, 92U);
}

{
Ref<JSON::Object> value = JSON::Object::create();
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 40U);
EXPECT_LE(memoryCost, 64U);
}

{
Expand Down Expand Up @@ -781,14 +781,14 @@ TEST(JSONValue, MemoryCost)
value->pushValue(JSON::Value::null());
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 48U);
EXPECT_LE(memoryCost, 64U);
}

{
Ref<JSON::Array> value = JSON::Array::create();
size_t memoryCost = value->memoryCost();
EXPECT_GT(memoryCost, 0U);
EXPECT_LE(memoryCost, 32U);
EXPECT_LE(memoryCost, 40U);
}

{
Expand Down

0 comments on commit 70e3b43

Please sign in to comment.