Something went wrong. Try again.
[mirror] Tool for collecting work URLs from AO3 list views
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142package logbuffer
import ( "strings" "testing")
func FuzzWrite(f *testing.F) { f.Add("Hello, World!") f.Add("Hello, World!\nLine2\nLine3")
f.Fuzz(func(t *testing.T, s string) { expectedLineCount := strings.Count(s, "\n") + 1
buf := NewLogBuffer() buf.Write([]byte(s))
if len(*buf.stream) != expectedLineCount { t.Fail() } })}
func FuzzGetAtMostFromEnd(f *testing.F) { f.Add("Hello, World!", 1) f.Add("Hello, World!", 10) f.Add("Hello, World!\nLine2\nLine3\nLine4\nLine5", 3)
f.Fuzz(func(t *testing.T, s string, l int) { buf := NewLogBuffer() buf.Write([]byte(s))
expectedLineCount := max(0, min(strings.Count(s, "\n")+1, l))
lines := buf.GetAtMostFromEnd(l)
if len(lines) != expectedLineCount { t.Fail() } })}