예제 #1
0
func TestExact(t *testing.T) {
	defer clearPatternCache()
	clearPatternCache()
	pattern := BuildPattern(true, true, CaseSmart, true,
		[]Range{}, Delimiter{}, []rune("'abc"))
	res := algo.ExactMatchNaive(
		pattern.caseSensitive, pattern.forward, []rune("aabbcc abc"), pattern.termSets[0][0].text)
	if res.Start != 7 || res.End != 10 {
		t.Errorf("%s / %d / %d", pattern.termSets, res.Start, res.End)
	}
}
예제 #2
0
파일: pattern_test.go 프로젝트: zennro/fzf
func TestExact(t *testing.T) {
	defer clearPatternCache()
	clearPatternCache()
	pattern := BuildPattern(ModeExtended, CaseSmart,
		[]Range{}, nil, []rune("'abc"))
	str := "aabbcc abc"
	sidx, eidx := algo.ExactMatchNaive(pattern.caseSensitive, &str, pattern.terms[0].text)
	if sidx != 7 || eidx != 10 {
		t.Errorf("%s / %d / %d", pattern.terms, sidx, eidx)
	}
}
예제 #3
0
func TestExact(t *testing.T) {
	defer clearPatternCache()
	clearPatternCache()
	pattern := BuildPattern(true, algo.FuzzyMatchV2, true, CaseSmart, true, true,
		[]Range{}, Delimiter{}, []rune("'abc"))
	res, pos := algo.ExactMatchNaive(
		pattern.caseSensitive, pattern.forward, util.RunesToChars([]rune("aabbcc abc")), pattern.termSets[0][0].text, true, nil)
	if res.Start != 7 || res.End != 10 {
		t.Errorf("%s / %d / %d", pattern.termSets, res.Start, res.End)
	}
	if pos != nil {
		t.Errorf("pos is expected to be nil")
	}
}