fast-replace/go-fast-replace/internal/replace/bm_test.go

18 lines
352 B
Go
Raw Normal View History

2023-12-30 21:35:09 +00:00
package replace
import (
"testing"
"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.")
}
}