summaryrefslogtreecommitdiff
path: root/flood_test.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2019-07-06 17:17:46 +0200
committerDimitri Sokolyuk <demon@dim13.org>2019-07-06 17:17:46 +0200
commit1d2ca509c77cbb2af0475b1319cd840f8ce9a1d0 (patch)
tree05a838baaf4f96fbcce03d06090a2403ee56c878 /flood_test.go
parent87e820722cf02054225b47a58f97d0824118292f (diff)
Split in packages
Diffstat (limited to 'flood_test.go')
-rw-r--r--flood_test.go51
1 files changed, 0 insertions, 51 deletions
diff --git a/flood_test.go b/flood_test.go
deleted file mode 100644
index 8f5045c..0000000
--- a/flood_test.go
+++ /dev/null
@@ -1,51 +0,0 @@
-package main
-
-import "testing"
-
-func TestFlood(t *testing.T) {
- testCases := []struct {
- line string
- isFlood bool
- }{
- {`! ! ! ! ! ! ! !`, true},
- {`test test test test abc abc`, true},
- {`! test ! test ! test ! test !`, true},
- {`a b c d e f g h i j`, false},
- {`const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };`, false},
- {`a = b > 3 ? 2 : 4`, false},
- {`AAAAAAAAAAAAAAAAAAAA`, true},
- {`AAAAAAAAAABBBBBBBBBB`, true},
- {`ivy 3 3 rho (iota 9) in 2 6 7 8 9`, false},
- {"\u262etest", true},
- }
- for _, tc := range testCases {
- t.Run(tc.line, func(t *testing.T) {
- if isFlood(tc.line) != tc.isFlood {
- t.Errorf("want %v", tc.isFlood)
- }
- })
- }
-}
-
-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)
- }
- })
- }
-}