Benjamin Bärthlein c4809b85b4 initial commit
2020-03-28 17:56:11 +01:00

30 lines
576 B
Go

package ipparser
import (
"testing"
)
func TestValidIP4ToReturnTrueOnValidAddress(t *testing.T) {
result := ValidIP4("1.2.3.4")
if result != true {
t.Fatalf("Expected ValidIP(1.2.3.4) to be true but got false")
}
}
func TestValidIP4ToReturnFalseOnInvalidAddress(t *testing.T) {
result := ValidIP4("abcd")
if result == true {
t.Fatalf("Expected ValidIP(abcd) to be false but got true")
}
}
func TestValidIP4ToReturnFalseOnEmptyAddress(t *testing.T) {
result := ValidIP4("")
if result == true {
t.Fatalf("Expected ValidIP() to be false but got true")
}
}