From 5e4abe0d17cb3a6bc94106936397a410129a24e5 Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 24 Jul 2018 15:57:46 +0200 Subject: collect in one place --- flood_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'flood_test.go') 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) + } + }) + } +} -- cgit v1.2.3