summaryrefslogtreecommitdiff
path: root/internal/flood/flood_test.go
blob: 18742549508be283416dda51c09a5a80f56ccc1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package flood

import "testing"

func TestFlood(t *testing.T) {
	testCases := []struct {
		line string
		ok   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.ok {
				t.Errorf("want %v", tc.ok)
			}
		})
	}
}