mirror of
https://github.com/taigrr/go-fastping
synced 2025-01-18 05:03:15 -08:00
check length after adding as well
This commit is contained in:
parent
42027cc47f
commit
9078c8f204
@ -43,14 +43,15 @@ func TestRemoveIP(t *testing.T) {
|
||||
if err := p.AddIP("127.0.0.1"); err != nil {
|
||||
t.Fatalf("AddIP failed: %v", err)
|
||||
}
|
||||
if len(p.addrs) != 1 {
|
||||
t.Fatalf("AddIP length check failed")
|
||||
}
|
||||
|
||||
if err := p.RemoveIP("127.0.0.1"); err != nil {
|
||||
t.Fatalf("RemoveIP failed: %v", err)
|
||||
}
|
||||
|
||||
length := len(p.addrs)
|
||||
if length != 0 {
|
||||
t.Fatalf("RemoveIP failed: got %v, expected %v", length, 0)
|
||||
if len(p.addrs) != 0 {
|
||||
t.Fatalf("RemoveIP length check failed")
|
||||
}
|
||||
}
|
||||
|
||||
@ -60,11 +61,13 @@ func TestRemoveIPAddr(t *testing.T) {
|
||||
if err := p.AddIP("127.0.0.1"); err != nil {
|
||||
t.Fatalf("AddIP failed: %v", err)
|
||||
}
|
||||
if len(p.addrs) != 1 {
|
||||
t.Fatalf("AddIP length check failed")
|
||||
}
|
||||
|
||||
p.RemoveIPAddr(&net.IPAddr{IP: net.IPv4(127, 0, 0, 1)})
|
||||
length := len(p.addrs)
|
||||
if length != 0 {
|
||||
t.Fatalf("RemoveIP failed: got %v, expected %v", length, 0)
|
||||
if len(p.addrs) != 0 {
|
||||
t.Fatalf("RemoveIPAddr length check failed")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user