From c939a03fb291b5371aaee4dc218d38c2ccb37541 Mon Sep 17 00:00:00 2001 From: Mika Savela Date: Thu, 12 Jan 2023 11:34:15 +0000 Subject: [PATCH] fix tests --- ping_test.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ping_test.go b/ping_test.go index 76cc45b..417175e 100644 --- a/ping_test.go +++ b/ping_test.go @@ -3,7 +3,6 @@ package ping import ( "bytes" "errors" - "fmt" "net" "runtime/debug" "sync/atomic" @@ -26,7 +25,7 @@ func TestProcessPacket(t *testing.T) { currentUUID := pinger.getCurrentTrackerUUID() uuidEncoded, err := currentUUID.MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), uuidEncoded...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -69,7 +68,7 @@ func TestProcessPacket_IgnoreNonEchoReplies(t *testing.T) { currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), currentUUID...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -112,7 +111,7 @@ func TestProcessPacket_IDMismatch(t *testing.T) { currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), currentUUID...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -154,7 +153,7 @@ func TestProcessPacket_TrackerMismatch(t *testing.T) { testUUID, err := uuid.New().MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), testUUID...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -192,7 +191,7 @@ func TestProcessPacket_LargePacket(t *testing.T) { currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), currentUUID...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -545,7 +544,7 @@ func BenchmarkProcessPacket(b *testing.B) { currentUUID, err := pinger.getCurrentTrackerUUID().MarshalBinary() if err != nil { - b.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + b.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), currentUUID...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 { @@ -595,7 +594,7 @@ func TestProcessPacket_IgnoresDuplicateSequence(t *testing.T) { currentUUID := pinger.getCurrentTrackerUUID() uuidEncoded, err := currentUUID.MarshalBinary() if err != nil { - t.Fatal(fmt.Sprintf("unable to marshal UUID binary: %s", err)) + t.Fatalf("unable to marshal UUID binary: %s", err) } data := append(timeToBytes(time.Now()), uuidEncoded...) if remainSize := pinger.Size - timeSliceLength - trackerLength; remainSize > 0 {