1
0
mirror of https://github.com/alice-lg/alice-lg.git synced 2024-05-11 05:55:03 +00:00
alice-lg-alice-lg/backend/utils_test.go
2017-06-30 15:02:12 +02:00

37 lines
643 B
Go

package main
import (
"testing"
)
func TestContainsCi(t *testing.T) {
if ContainsCi("foo bar", "BaR") != true {
t.Error("An unexpected error occured.")
}
}
func TestMaybePrefix(t *testing.T) {
expected := []struct {
string
bool
}{
{"10.0.0", true},
{"23.42.11.42/23", true},
{"200", true},
{"2001:", true},
{"A", true},
{"A b", false},
{"23 Foo", false},
{"Nordfoo", false},
{"122.beef:", true}, // sloppy
{"122.beef:", true}, // very
{"122:beef", true}, // sloppy.
}
for _, e := range expected {
if MaybePrefix(e.string) != e.bool {
t.Error("Expected", e.string, "to be prefix:", e.bool)
}
}
}