message-size-increase #3

Open
sashakoshka wants to merge 132 commits from message-size-increase into main
2 changed files with 5 additions and 0 deletions
Showing only changes of commit 712b4f521c - Show all commits

View File

@ -57,6 +57,9 @@ func (sn Snake) Check(data []byte) (ok bool, n int) {
if !found { return false, n } if !found { return false, n }
} }
} }
if n < len(data) {
return false, n
}
return true, n return true, n
} }

View File

@ -32,6 +32,8 @@ func TestSnakeA(test *testing.T) {
if ok { test.Fatal("false positive:", n) } if ok { test.Fatal("false positive:", n) }
ok, n = snake.Check([]byte { 1, 6, 7, 3, 1, 4, 2, 5, 9 }) ok, n = snake.Check([]byte { 1, 6, 7, 3, 1, 4, 2, 5, 9 })
if ok { test.Fatal("false positive:", n) } if ok { test.Fatal("false positive:", n) }
ok, n = snake.Check([]byte { 1, 6, 1, 2, 3, 4, 5, 9, 10})
if ok { test.Fatal("false positive:", n) }
} }
func TestSnakeB(test *testing.T) { func TestSnakeB(test *testing.T) {