MCPcopy Create free account
hub / github.com/dlclark/regexp2 / TestStringFixedDistanceSetFilter

Function TestStringFixedDistanceSetFilter

stringprefixfilter_test.go:232–251  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

230}
231
232func TestStringFixedDistanceSetFilter(t *testing.T) {
233 filter := stringFixedDistanceSetFilter(syntax.FixedDistanceSet{
234 Range: &syntax.SingleRange{First: 'a', Last: 'c'},
235 Distance: 2,
236 }, 3)
237 if filter == nil {
238 t.Fatal("expected filter")
239 }
240
241 candidateByteIndex, ok := filter("é12b", 0)
242 if !ok {
243 t.Fatal("expected candidate")
244 }
245 if got, want := candidateByteIndex, 2; got != want {
246 t.Fatalf("candidateByteIndex = %d, want %d", got, want)
247 }
248 if _, ok := filter("é12z", 0); ok {
249 t.Fatal("unexpected candidate")
250 }
251}
252
253func TestStringFixedDistanceSetFilterSmallSet(t *testing.T) {
254 filter := stringFixedDistanceSetFilter(syntax.FixedDistanceSet{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected