Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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!;
Expand Down
13 changes: 12 additions & 1 deletion src/Ivy.NativeJsonDiff.Tests/JsonPayloadGeneratorTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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");
// ~1MB expected
Assert.InRange(oldBytes.Length, 500_000, 5_000_000);
Assert.InRange(newBytes.Length, 500_000, 5_000_000);
}

[Fact]
public void Generate_OldAndNew_AreDifferent()
{
Expand All @@ -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]
Expand Down
Loading