leetcode-go/src/string_match_test.go

29 lines
582 B
Go
Raw Normal View History

2022-06-19 08:59:41 +00:00
package src
import (
"fmt"
"testing"
)
func TestBf(t *testing.T) {
s := "bacbababaabcbab"
2023-03-06 12:05:59 +00:00
p := "abababca"
2022-06-19 08:59:41 +00:00
fmt.Printf("bf %s match %s index is: %+v\n", p, s, bf(s, p))
// t.Logf("%s match %s index is: %+v\n", p, s, bf(s, p))
}
func TestGetNext(t *testing.T) {
2023-03-06 12:05:59 +00:00
p := "abababca"
2022-06-19 08:59:41 +00:00
fmt.Printf("getNext %s next is: %+v\n", p, getNext(p))
// t.Logf("%s next is: %+v\n", p, next)
}
func TestKmp(t *testing.T) {
s := "bacbababaabcbab"
2023-03-06 12:05:59 +00:00
p := "abababca"
2022-06-19 08:59:41 +00:00
fmt.Printf("kmp %s match %s index is: %+v\n", p, s, kmp(s, p))
// t.Logf("%s match %s index is: %+v\n", p, s, kmp(s, p))
}