mirror of
https://github.com/netbirdio/easyjson.git
synced 2026-05-22 18:44:42 -07:00
fix allocs expectations in tests
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user