package replace import ( "testing" "internal/corpus" "internal/pairs" "internal/replace" ) func TestBoyerMooreReplace(t *testing.T) { var corpus string = "abcdefghi012345jklmnopqrst" var pairs = []string{"012345", "ABCDEF"} var want string = "abcdefghiABCDEFjklmnopqrst" got := replace.BoyerMooreReplace(corpus, pairs) if want != got { t.Error("Replacement was wrong.") } } func BenchmarkBoyerMooreReplace(b *testing.B) { var amount int = 1000 var corpus string = corpus.MakeCorpus(amount) var pairs []string = pairs.MakePairs(amount) for n := 0; n < b.N; n++ { replace.BoyerMooreReplace(corpus, pairs) } }