From 5a94f97a4fcc41f1dbe1dc26dfb8afcb36108452 Mon Sep 17 00:00:00 2001 From: ping40 Date: Sat, 27 Oct 2018 16:06:24 +0800 Subject: [PATCH] pkg/ioutil: n is equal or greater than cw.writeBytes --- pkg/ioutil/pagewriter_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/ioutil/pagewriter_test.go b/pkg/ioutil/pagewriter_test.go index cdeaba926..10610691c 100644 --- a/pkg/ioutil/pagewriter_test.go +++ b/pkg/ioutil/pagewriter_test.go @@ -37,8 +37,8 @@ func TestPageWriterRandom(t *testing.T) { if cw.writeBytes > n { t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n) } - if cw.writeBytes-n > pageBytes { - t.Fatalf("got %d bytes pending, expected less than %d bytes", cw.writeBytes-n, pageBytes) + if n-cw.writeBytes > pageBytes { + t.Fatalf("got %d bytes pending, expected less than %d bytes", n-cw.writeBytes, pageBytes) } t.Logf("total writes: %d", cw.writes) t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n)