diff --git a/tests/intern_test.go b/tests/intern_test.go index 480f87c..4c73002 100644 --- a/tests/intern_test.go +++ b/tests/intern_test.go @@ -20,8 +20,8 @@ func TestStringIntern(t *testing.T) { t.Fatalf("wrong value: %q", i.Field) } }) - if allocsPerRun != 1 { - t.Fatalf("expected 1 allocs, got %f", allocsPerRun) + if allocsPerRun > 1 { + t.Fatalf("expected <= 1 allocs, got %f", allocsPerRun) } var n NoIntern @@ -35,7 +35,7 @@ func TestStringIntern(t *testing.T) { t.Fatalf("wrong value: %q", n.Field) } }) - if allocsPerRun != 2 { - t.Fatalf("expected 2 allocs, got %f", allocsPerRun) + if allocsPerRun > 2 { + t.Fatalf("expected <= 2 allocs, got %f", allocsPerRun) } } diff --git a/tests/nocopy_test.go b/tests/nocopy_test.go index 05dccee..63dfc5f 100644 --- a/tests/nocopy_test.go +++ b/tests/nocopy_test.go @@ -53,8 +53,8 @@ func TestNocopy(t *testing.T) { t.Fatalf("wrong value: %q", res.B) } }) - if allocsPerRun != 1 { - t.Fatalf("noCopy field unmarshal: expected 1 allocs, got %f", allocsPerRun) + if allocsPerRun > 1 { + t.Fatalf("noCopy field unmarshal: expected <= 1 allocs, got %f", allocsPerRun) } data = []byte(`{"a": "valueNoCopy"}`) @@ -67,7 +67,7 @@ func TestNocopy(t *testing.T) { t.Fatalf("wrong value: %q", res.A) } }) - if allocsPerRun != 2 { - t.Fatalf("copy field unmarshal: expected 2 allocs, got %f", allocsPerRun) + if allocsPerRun > 2 { + t.Fatalf("copy field unmarshal: expected <= 2 allocs, got %f", allocsPerRun) } }