fix allocs expectations in tests

This commit is contained in:
bulletmys
2021-10-10 19:42:20 +03:00
parent eecedd19f7
commit 52ae64103b
2 changed files with 8 additions and 8 deletions
+4 -4
View File
@@ -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)
}
}
+4 -4
View File
@@ -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)
}
}