]> Cypherpunks repositories - gostls13.git/commitdiff
net: simplify bool expression
authorludweeg <mursalimovemeel@gmail.com>
Sat, 6 Oct 2018 15:38:37 +0000 (18:38 +0300)
committerMikio Hara <mikioh.mikioh@gmail.com>
Sun, 7 Oct 2018 02:36:02 +0000 (02:36 +0000)
Simplify `!(x <= y)` to `x > y` and `!(x >= y)` to `x < y` where x,y are not defined as float.

Change-Id: Id1e5b518395d97e75f96aa4ac5d6c0ee990c0e7d
Reviewed-on: https://go-review.googlesource.com/c/140337
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
src/net/dial_test.go

index 00a84d17d60599a2aebb4c80481f27f93a3d749e..3a45c0d2ec9a757a0beee66f3f76e41b9eabb360 100644 (file)
@@ -318,9 +318,9 @@ func TestDialParallel(t *testing.T) {
 
                expectElapsedMin := tt.expectElapsed - 95*time.Millisecond
                expectElapsedMax := tt.expectElapsed + 95*time.Millisecond
-               if !(elapsed >= expectElapsedMin) {
+               if elapsed < expectElapsedMin {
                        t.Errorf("#%d: got %v; want >= %v", i, elapsed, expectElapsedMin)
-               } else if !(elapsed <= expectElapsedMax) {
+               } else if elapsed > expectElapsedMax {
                        t.Errorf("#%d: got %v; want <= %v", i, elapsed, expectElapsedMax)
                }
 
@@ -418,10 +418,10 @@ func TestDialerFallbackDelay(t *testing.T) {
                }
                expectMin := tt.expectElapsed - 1*time.Millisecond
                expectMax := tt.expectElapsed + 95*time.Millisecond
-               if !(elapsed >= expectMin) {
+               if elapsed < expectMin {
                        t.Errorf("#%d: got %v; want >= %v", i, elapsed, expectMin)
                }
-               if !(elapsed <= expectMax) {
+               if elapsed > expectMax {
                        t.Errorf("#%d: got %v; want <= %v", i, elapsed, expectMax)
                }
        }