summaryrefslogtreecommitdiff
path: root/flood_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'flood_test.go')
-rw-r--r--flood_test.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/flood_test.go b/flood_test.go
index 175779d..8fc0194 100644
--- a/flood_test.go
+++ b/flood_test.go
@@ -25,3 +25,26 @@ func TestFlood(t *testing.T) {
})
}
}
+
+func TestNoSpaceCompare(t *testing.T) {
+ testCases := []struct {
+ a, b string
+ ok bool
+ }{
+ {"", "", true},
+ {"x", "", false},
+ {"", "x", false},
+ {"x ", "x", true},
+ {" x", "x", true},
+ {"x x", "xx", true},
+ {"x x x", "x", false},
+ }
+ for _, tc := range testCases {
+ t.Run(tc.a+"?"+tc.b, func(t *testing.T) {
+ ok := noSpaceCompare(tc.a, tc.b)
+ if ok != tc.ok {
+ t.Errorf("got %v; want %v", ok, tc.ok)
+ }
+ })
+ }
+}