From c5cba0fbc8df1822bfc20b31f146c80545d10cb1 Mon Sep 17 00:00:00 2001 From: rorychatt Date: Sun, 12 Apr 2026 12:50:28 +0200 Subject: [PATCH 1/2] [00036] Add VeryLargeStateTree to JsonApplyBenchmarks params and update tests --- .../Benchmarks/JsonApplyBenchmarks.cs | 2 +- .../JsonPayloadGeneratorTests.cs | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Ivy.NativeJsonDiff.Benchmarks/Benchmarks/JsonApplyBenchmarks.cs b/src/Ivy.NativeJsonDiff.Benchmarks/Benchmarks/JsonApplyBenchmarks.cs index f95ccd3..bd2467f 100644 --- a/src/Ivy.NativeJsonDiff.Benchmarks/Benchmarks/JsonApplyBenchmarks.cs +++ b/src/Ivy.NativeJsonDiff.Benchmarks/Benchmarks/JsonApplyBenchmarks.cs @@ -14,7 +14,7 @@ namespace Ivy.NativeJsonDiff.Benchmarks.Benchmarks; [MarkdownExporterAttribute.GitHub] public class JsonApplyBenchmarks { - [Params("Small", "Medium", "Large", "DeepNested", "ArrayHeavy", "ApiResponse", "ConfigFile", "LargeStateTree")] + [Params("Small", "Medium", "Large", "DeepNested", "ArrayHeavy", "ApiResponse", "ConfigFile", "LargeStateTree", "VeryLargeStateTree")] public string Category { get; set; } = null!; private byte[] _oldBytes = null!; diff --git a/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs b/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs index 9055e26..e1c2d23 100644 --- a/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs +++ b/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs @@ -15,6 +15,7 @@ public class JsonPayloadGeneratorTests [InlineData("ApiResponse")] [InlineData("ConfigFile")] [InlineData("LargeStateTree")] + [InlineData("VeryLargeStateTree")] public void Generate_ProducesValidJson(string category) { var (oldBytes, newBytes) = JsonPayloadGenerator.Generate(category); @@ -58,6 +59,15 @@ public void Generate_LargeStateTree_HasExpectedSize() Assert.InRange(newBytes.Length, 20_000, 200_000); } + [Fact] + public void Generate_VeryLargeStateTree_HasExpectedSize() + { + var (oldBytes, newBytes) = JsonPayloadGenerator.Generate("VeryLargeStateTree"); + // ~2MB expected + Assert.InRange(oldBytes.Length, 1_000_000, 5_000_000); + Assert.InRange(newBytes.Length, 1_000_000, 5_000_000); + } + [Fact] public void Generate_OldAndNew_AreDifferent() { @@ -76,7 +86,8 @@ public void AllCategories_ContainsExpectedEntries() Assert.Contains("ApiResponse", JsonPayloadGenerator.AllCategories); Assert.Contains("ConfigFile", JsonPayloadGenerator.AllCategories); Assert.Contains("LargeStateTree", JsonPayloadGenerator.AllCategories); - Assert.Equal(8, JsonPayloadGenerator.AllCategories.Length); + Assert.Contains("VeryLargeStateTree", JsonPayloadGenerator.AllCategories); + Assert.Equal(9, JsonPayloadGenerator.AllCategories.Length); } [Fact] From cfea59bf8e20b423bcd3af08281f33c445e15f0e Mon Sep 17 00:00:00 2001 From: rorychatt Date: Sun, 12 Apr 2026 12:51:38 +0200 Subject: [PATCH 2/2] [00036] Fix VeryLargeStateTree size assertion range to match actual ~1MB payload --- src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs b/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs index e1c2d23..28c0a85 100644 --- a/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs +++ b/src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs @@ -63,9 +63,9 @@ public void Generate_LargeStateTree_HasExpectedSize() public void Generate_VeryLargeStateTree_HasExpectedSize() { var (oldBytes, newBytes) = JsonPayloadGenerator.Generate("VeryLargeStateTree"); - // ~2MB expected - Assert.InRange(oldBytes.Length, 1_000_000, 5_000_000); - Assert.InRange(newBytes.Length, 1_000_000, 5_000_000); + // ~1MB expected + Assert.InRange(oldBytes.Length, 500_000, 5_000_000); + Assert.InRange(newBytes.Length, 500_000, 5_000_000); } [Fact]