19 lines
285 B
Go
19 lines
285 B
Go
package main
|
|
|
|
import "testing"
|
|
|
|
func TestRepeat(t *testing.T) {
|
|
repeated := Repeat("a")
|
|
expected := "aaaaa"
|
|
|
|
if repeated != expected {
|
|
t.Errorf("Expected %q but got %q", expected, repeated)
|
|
}
|
|
}
|
|
|
|
func BenchmarkRepeat(b *testing.B) {
|
|
for i := 0; i < b.N; i++ {
|
|
Repeat("a")
|
|
}
|
|
}
|