Merge pull request #567 from prometheus/beorn7/counter

Make TestCounterAddLarge more robust
This commit is contained in:
Björn Rabenstein 2019-05-04 18:08:04 +02:00 committed by GitHub
commit 906d2976cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -172,7 +172,7 @@ func TestCounterAddLarge(t *testing.T) {
}).(*counter) }).(*counter)
// large overflows the underlying type and should therefore be stored in valBits. // large overflows the underlying type and should therefore be stored in valBits.
large := float64(math.MaxUint64 + 1) large := math.Nextafter(float64(math.MaxUint64), 1e20)
counter.Add(large) counter.Add(large)
if expected, got := large, math.Float64frombits(counter.valBits); expected != got { if expected, got := large, math.Float64frombits(counter.valBits); expected != got {
t.Errorf("valBits expected %f, got %f.", expected, got) t.Errorf("valBits expected %f, got %f.", expected, got)