]> Cypherpunks.ru repositories - nncp.git/blobdiff - src/toss_test.go
Simplified conditions
[nncp.git] / src / toss_test.go
index e0f682b8b5fb5c3c68659ee63eea7501cb5a5c52..966b2b84ae4a0914d42ad2681e64dbca6b4e4bc1 100644 (file)
@@ -150,7 +150,7 @@ func TestTossExec(t *testing.T) {
                        )
                        expected = append(expected, []byte("BODY\n")...)
                }
-               return bytes.Compare(mbox, expected) == 0
+               return bytes.Equal(mbox, expected)
        }
        if err := quick.Check(f, nil); err != nil {
                t.Error(err)
@@ -240,7 +240,7 @@ func TestTossFile(t *testing.T) {
                        if err != nil {
                                panic(err)
                        }
-                       if bytes.Compare(data, fileData) != 0 {
+                       if !bytes.Equal(data, fileData) {
                                return false
                        }
                }
@@ -315,10 +315,7 @@ func TestTossFileSameName(t *testing.T) {
                        }
                        delete(expected, filename)
                }
-               if len(expected) != 0 {
-                       return false
-               }
-               return true
+               return len(expected) == 0
        }
        if err := quick.Check(f, nil); err != nil {
                t.Error(err)
@@ -423,8 +420,7 @@ func TestTossFreq(t *testing.T) {
                        if pkt.Nice != replyNice {
                                return false
                        }
-                       dst := string(pkt.Path[:int(pkt.PathLen)])
-                       if bytes.Compare(buf.Bytes(), files[dst]) != 0 {
+                       if !bytes.Equal(buf.Bytes(), files[string(pkt.Path[:int(pkt.PathLen)])]) {
                                return false
                        }
                }
@@ -514,15 +510,12 @@ func TestTossTrns(t *testing.T) {
                                panic(err)
                        }
                        for k, data := range datum {
-                               if bytes.Compare(dataRead, data) == 0 {
+                               if bytes.Equal(dataRead, data) {
                                        delete(datum, k)
                                }
                        }
                }
-               if len(datum) > 0 {
-                       return false
-               }
-               return true
+               return len(datum) == 0
        }
        if err := quick.Check(f, nil); err != nil {
                t.Error(err)