mirror of
https://github.com/go-ping/ping.git
synced 2025-07-19 08:26:51 +00:00
fix tests
This commit is contained in:
parent
1c7ace28c4
commit
c939a03fb2
15
ping_test.go
15
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user