package main import "testing" type floodTest struct { Input string Result bool } var floodTestData = []floodTest{ { Input: `! ! ! ! ! ! ! !`, Result: true, }, { Input: `test test test test abc abc`, Result: true, }, { Input: `! test ! test ! test ! test !`, Result: true, }, { Input: `a b c d e f g h i j`, Result: false, }, { Input: `const union __infinity_un __infinity = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };`, Result: false, }, { Input: `a = b > 3 ? 2 : 4`, Result: false, }, { Input: `AAAAAAAAAAAAAAAAAAAA`, Result: true, }, { Input: `AAAAAAAAAABBBBBBBBBB`, Result: true, }, { Input: `ivy 3 3 rho (iota 9) in 2 6 7 8 9`, Result: false, }, } func TestFlood(t *testing.T) { for _, test := range floodTestData { if isFlood(test.Input) != test.Result { t.Error(test.Input, "expected", test.Result) } } }