warpdotdev/warp at 714c51f1e2: the project's own tests caught 6 of 37 planted faults, 31 got through, and corral proved 28 of those missing tests by writing a test and running it.
#[cfg(test)]
mod corral_tests {
use super::super::*;
#[test]
fn test_wildcard_substring_indices_within_bounds_s0_m1() {
let text = "/src/ui/button.rs";
let pattern = "ui/*.rs";
let char_count = text.chars().count();
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds (text length is {})",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![5, 6, 7, 14, 15, 16]);
}
#[test]
fn test_wildcard_matched_indices_within_bounds() {
let cases = [
("ui/button.rs", "ui/*t?n.rs"),
("/src/ui/button.rs", "ui/*t?n.rs"),
("prefix/file.test.txt", "prefix/*.*.txt"),
];
for (text, pattern) in cases {
let result = match_wildcard_pattern(text, pattern)
.unwrap_or_else(|| panic!("pattern '{}' should match '{}'", pattern, text));
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text '{}' (len {}) with pattern '{}'",
idx,
text,
char_count,
pattern
);
}
}
}
#[test]
fn test_substring_wildcard_matched_indices_bounds() {
let text = "/src/ui/button.rs";
let pattern = "ui/*.rs";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} must be within bounds of text (char count {})",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![5, 6, 7, 14, 15, 16]);
}
#[test]
fn test_substring_wildcard_partial_suffix_matched_indices() {
let text = "/src/ui/button.rs";
let pattern = "ui/*.r";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} must be within bounds of text (char count {})",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![5, 6, 7, 14, 15]);
}
#[test]
fn test_wildcard_substring_indices_within_bounds_s0_m4() {
let text = "/src/ui/button.rs";
let pattern = "ui/*.rs";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text with {} characters",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![5, 6, 7, 14, 15, 16]);
}
#[test]
fn test_wildcard_substring_partial_suffix_indices_within_bounds() {
let text = "/src/ui/button.rs";
let pattern = "ui/*.r";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text with {} characters",
idx,
char_count
);
}
}
#[test]
fn test_matched_indices_bounds_for_wildcard_pattern() {
let text = "test1.rs";
let pattern = "test?.rs";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
assert!(!result.matched_indices.is_empty());
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text of length {}",
idx,
char_count
);
}
}
#[test]
fn test_matched_indices_bounds_for_substring_question_mark_pattern() {
let text = "hello_world";
let pattern = "w?rld";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
assert!(!result.matched_indices.is_empty());
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text of length {}",
idx,
char_count
);
}
}
#[test]
fn test_matched_indices_within_bounds() {
let cases = [
("button.rs", "butto?.rs"),
("test1.rs", "test?.rs"),
("xyz", "x?z"),
];
for (text, pattern) in cases {
let result = match_wildcard_pattern(text, pattern).expect("expected pattern to match");
let text_len = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < text_len,
"matched index {} is out of bounds for text '{}' with length {}",
idx,
text,
text_len
);
}
}
}
#[test]
fn test_exact_suffix_matched_indices_bounds() {
let text = "button.rs";
let pattern = "*.rs";
let result = match_wildcard_pattern(text, pattern).expect("expected match for *.rs");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text of length {}",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![6, 7, 8]);
}
#[test]
fn test_wildcard_suffix_indices_within_bounds() {
let text = "button.rs";
let pattern = "*.rs";
let result = match_wildcard_pattern(text, pattern).expect("should match pattern");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} must be within bounds (text char count: {})",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![6, 7, 8]);
}
#[test]
fn test_wildcard_suffix_short_text_indices_within_bounds() {
let text = "file.txt";
let pattern = "*.txt";
let result = match_wildcard_pattern(text, pattern).expect("should match pattern");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} must be within bounds (text char count: {})",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![4, 5, 6, 7]);
}
#[test]
fn test_wildcard_partial_suffix_matched_indices_bounds() {
let text = "button.rs";
let pattern = "*.r";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text with length {}",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![6, 7]);
}
#[test]
fn test_wildcard_partial_suffix_component_tsx_bounds() {
let text = "component.tsx";
let pattern = "*.t";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text with length {}",
idx,
char_count
);
}
}
#[test]
fn test_wildcard_prefix_matched_indices_within_bounds() {
let text = "src/main.rs";
let pattern = "src/*";
let result = match_wildcard_pattern(text, pattern).expect("expected pattern match");
let char_count = text.chars().count();
assert!(!result.matched_indices.is_empty());
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text with {} chars",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![0, 1, 2, 3]);
}
#[test]
fn test_wildcard_prefix_matched_indices_short_text_within_bounds() {
let text = "a/b";
let pattern = "a/*";
let result = match_wildcard_pattern(text, pattern).expect("expected pattern match");
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text of length {}",
idx,
char_count
);
}
assert_eq!(result.matched_indices, vec![0, 1]);
}
#[test]
fn test_prefix_wildcard_matched_indices_within_bounds() {
let text = "src/ui/button.rs";
let pattern = "src/*";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
let text_char_count = text.chars().count();
assert!(!result.matched_indices.is_empty());
for &idx in &result.matched_indices {
assert!(
idx < text_char_count,
"matched index {idx} exceeds text char count {text_char_count}"
);
}
assert_eq!(result.matched_indices, vec![0, 1, 2, 3]);
}
#[test]
fn test_match_wildcard_pattern_indices_within_bounds() {
let test_cases = [
("/src/ui/button.rs", "ui/*"),
("/src/ui/button.rs", "ui/*.rs"),
("/path/to/component.tsx", "component*"),
("some/nested/dir/file.txt", "dir/*.txt"),
];
for (text, pattern) in test_cases {
let char_count = text.chars().count();
let result = match_wildcard_pattern(text, pattern).expect("expected pattern to match");
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text {:?} with length {}",
idx,
text,
char_count
);
}
}
}
#[test]
fn test_substring_glob_match_exact_indices() {
let text = "/src/ui/button.rs";
let pattern = "ui/*";
let result = match_wildcard_pattern(text, pattern).expect("expected pattern to match");
// "ui/" starts at character index 5 and has length 3, so indices must be exactly [5, 6, 7]
assert_eq!(result.matched_indices, vec![5, 6, 7]);
}
#[test]
fn test_wildcard_pattern_matched_indices_within_bounds() {
let cases = [
("東", "???"),
("🦀", "????"),
("hello東world", "hello???world"),
];
for (text, pattern) in cases {
let result = match_wildcard_pattern(text, pattern);
assert!(
result.is_some(),
"expected match for text='{}', pattern='{}'",
text,
pattern
);
let match_result = result.unwrap();
let char_count = text.chars().count();
assert_eq!(
match_result.matched_indices.len(),
char_count,
"expected matched indices count to equal char count for text='{}'",
text
);
for &idx in &match_result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text '{}' (char count {})",
idx,
text,
char_count
);
}
}
}
#[test]
fn test_wildcard_no_match_when_text_exhausted_but_pattern_has_chars_after_star() {
assert!(match_wildcard_pattern("foo", "foo*bar").is_none());
assert!(match_wildcard_pattern("abc", "abc*d").is_none());
assert!(match_wildcard_pattern("test.rs", "test.rs*extra").is_none());
assert!(match_wildcard_pattern_case_insensitive("Foo", "foo*bar").is_none());
}
#[test]
fn test_glob_match_chars_zero_length_star() {
let text: Vec<char> = "abc".chars().collect();
let pattern: Vec<char> = "a*b*c".chars().collect();
assert!(is_glob_match_chars(&text, &pattern));
let text2: Vec<char> = "ab".chars().collect();
let pattern2: Vec<char> = "a*b".chars().collect();
assert!(is_glob_match_chars(&text2, &pattern2));
let text3: Vec<char> = "a".chars().collect();
let pattern3: Vec<char> = "*a".chars().collect();
assert!(is_glob_match_chars(&text3, &pattern3));
let text4: Vec<char> = "a".chars().collect();
let pattern4: Vec<char> = "a*".chars().collect();
assert!(is_glob_match_chars(&text4, &pattern4));
}
#[test]
fn test_wildcard_pattern_question_star_indices_in_bounds() {
let text = "xyz ab";
let pattern = "?*b";
let result = match_wildcard_pattern(text, pattern);
assert!(result.is_some());
let match_result = result.unwrap();
let text_char_count = text.chars().count();
assert!(!match_result.matched_indices.is_empty());
for &idx in &match_result.matched_indices {
assert!(idx < text_char_count);
}
}
#[test]
fn test_wildcard_star_matches_to_end_of_slice() {
let text = "xxab";
let pattern = "?a*";
let result = match_wildcard_pattern(text, pattern);
assert!(result.is_some(), "Pattern '{pattern}' should match text '{text}'");
let match_result = result.unwrap();
assert_eq!(match_result.matched_indices, vec![1, 2, 3]);
for &idx in &match_result.matched_indices {
assert!(idx < text.chars().count());
}
}
#[test]
fn test_wildcard_question_star_substring_match() {
let text = "path/to/file.txt";
let pattern = "?to*";
let result = match_wildcard_pattern(text, pattern);
assert!(result.is_some(), "Pattern '{pattern}' should match text '{text}'");
let match_result = result.unwrap();
assert!(!match_result.matched_indices.is_empty());
for &idx in &match_result.matched_indices {
assert!(idx < text.chars().count());
}
}
#[test]
fn test_wildcard_question_mark_requires_character_and_indices_in_bounds() {
let text = "path/to/file.txt";
let pattern = "fil?.txt";
let result = match_wildcard_pattern(text, pattern);
assert!(
result.is_some(),
"Pattern '{}' should match '{}'",
pattern,
text
);
let match_result = result.unwrap();
let char_count = text.chars().count();
assert!(!match_result.matched_indices.is_empty());
for &idx in &match_result.matched_indices {
assert!(
idx < char_count,
"Matched index {} must be within text character bounds 0..{}",
idx,
char_count
);
}
// '?' must consume exactly one character; if that character is absent, it must not match
let text_missing_char = "path/to/fil.txt";
let no_match_result = match_wildcard_pattern(text_missing_char, pattern);
assert!(
no_match_result.is_none(),
"Pattern '{}' should not match '{}' because '?' cannot match zero characters",
pattern,
text_missing_char
);
}
#[test]
fn test_wildcard_case_insensitive_question_mark_indices_in_bounds() {
let text = "PATH/TO/FILE.TXT";
let pattern = "fil?.txt";
let result = match_wildcard_pattern_case_insensitive(text, pattern);
assert!(result.is_some());
let match_result = result.unwrap();
let char_count = text.chars().count();
assert!(!match_result.matched_indices.is_empty());
for &idx in &match_result.matched_indices {
assert!(
idx < char_count,
"Matched index {} must be within text character bounds 0..{}",
idx,
char_count
);
}
let text_missing_char = "PATH/TO/FIL.TXT";
assert!(match_wildcard_pattern_case_insensitive(text_missing_char, pattern).is_none());
}
#[test]
fn test_wildcard_pattern_substring_question_mark_indices_in_bounds() {
let text = "prefix_abc";
let pattern = "a?c";
let result = match_wildcard_pattern(text, pattern);
assert!(result.is_some());
let match_result = result.unwrap();
let char_count = text.chars().count();
assert!(!match_result.matched_indices.is_empty());
for &idx in &match_result.matched_indices {
assert!(idx < char_count, "matched index {} out of bounds {}", idx, char_count);
}
assert_eq!(match_result.matched_indices, vec![7, 8, 9]);
let mismatch = match_wildcard_pattern(text, "x?z");
assert!(mismatch.is_none());
}
#[test]
fn test_wildcard_pattern_question_mark_literal_mismatch() {
let text = "dir/hello_file";
let pattern = "f?le";
let result = match_wildcard_pattern(text, pattern);
assert!(result.is_some());
let match_result = result.unwrap();
let char_count = text.chars().count();
for &idx in &match_result.matched_indices {
assert!(idx < char_count, "matched index {} out of bounds {}", idx, char_count);
}
let bad_match = match_wildcard_pattern(text, "z?le");
assert!(bad_match.is_none());
}
#[test]
fn test_wildcard_pattern_unmatched_trailing_pattern_after_star() {
let result = match_wildcard_pattern("src/main.rs", "*main*extra");
assert!(result.is_none());
let result2 = match_wildcard_pattern("button.rs", "*button*xyz");
assert!(result2.is_none());
let result3 = match_wildcard_pattern("hello", "*hello*world");
assert!(result3.is_none());
}
#[test]
fn test_is_glob_match_star_zero_chars() {
assert!(is_glob_match("ab", "a*b"));
assert!(is_glob_match("a", "*a"));
assert!(is_glob_match("abc", "a*b*c"));
assert!(is_glob_match("hello.txt", "hello*.txt"));
assert!(is_glob_match("test", "*test*"));
}
#[test]
fn test_is_glob_match_question_mark_advances_char() {
assert!(is_glob_match("a", "?"));
assert!(!is_glob_match("ab", "?"));
assert!(is_glob_match("abc", "a?c"));
assert!(!is_glob_match("ac", "a?c"));
assert!(is_glob_match("test.rs", "te?t.rs"));
assert!(!is_glob_match("tet.rs", "te?t.rs"));
}
#[test]
fn test_wildcard_pattern_with_star_and_question_mark() {
let result = match_wildcard_pattern("src/ui/btn.rs", "src/*?tn.rs");
assert!(result.is_some());
let match_result = result.unwrap();
assert!(match_result.score > 0);
assert!(!match_result.matched_indices.is_empty());
let char_count = "src/ui/btn.rs".chars().count();
for &idx in &match_result.matched_indices {
assert!(idx < char_count);
}
let no_match = match_wildcard_pattern("src/tn.rs", "src/*?tn.rs");
assert!(no_match.is_none());
}
#[test]
fn test_is_glob_match_exact_and_wildcard() {
assert!(is_glob_match("button.rs", "button.rs"));
assert!(is_glob_match("button.rs", "b*n.rs"));
assert!(is_glob_match("button.rs", "b?tton.rs"));
assert!(!is_glob_match("button.rs", "cutton.rs"));
}
#[test]
fn test_is_glob_match_recursive_bytes() {
assert!(is_glob_match_recursive(b"button.rs", b"button.rs", 0, 0));
assert!(is_glob_match_recursive(b"button.rs", b"b*t?on.rs", 0, 0));
assert!(!is_glob_match_recursive(b"button.rs", b"xutton.rs", 0, 0));
}
#[test]
fn test_partial_suffix_match_indices_bounds_and_exact_indices() {
let text = "button.rs";
let pattern = "*.r";
let result = match_wildcard_pattern(text, pattern).expect("pattern should match");
assert_eq!(result.matched_indices, vec![6, 7]);
for &idx in &result.matched_indices {
assert!(
idx < text.chars().count(),
"matched index {} is out of bounds for text of length {}",
idx,
text.chars().count()
);
}
}
#[test]
fn test_find_partial_suffix_match_exact_length_indices() {
let text = "test.file";
let partial_suffix = ".fil";
let indices = find_partial_suffix_match(text, partial_suffix).expect("suffix should match");
assert_eq!(indices, vec![4, 5, 6, 7]);
assert_eq!(indices.len(), partial_suffix.chars().count());
for &idx in &indices {
assert!(idx < text.chars().count());
}
}
#[test]
fn test_find_partial_suffix_match_at_end_bounds() {
let text = "file.r";
let partial_suffix = ".r";
let indices = find_partial_suffix_match(text, partial_suffix).expect("suffix should match");
assert_eq!(indices, vec![4, 5]);
for &idx in &indices {
assert!(
idx < text.chars().count(),
"matched index {} must be strictly less than text character count {}",
idx,
text.chars().count()
);
}
}
#[test]
fn test_partial_suffix_matched_indices_within_bounds() {
let cases = [
("button.rs", "*.r", vec![6, 7]),
("component.tsx", "*.t", vec![9, 10]),
("test.js", "*.", vec![4]),
("/src/ui/button.rs", "ui/*.r", vec![5, 6, 7, 14, 15]),
];
for (text, pattern, expected_indices) in cases {
let result = match_wildcard_pattern(text, pattern)
.unwrap_or_else(|| panic!("expected match for text='{}', pattern='{}'", text, pattern));
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"matched index {} is out of bounds for text '{}' of length {}",
idx,
text,
char_count
);
}
assert_eq!(
result.matched_indices, expected_indices,
"matched indices mismatch for text='{}', pattern='{}'",
text, pattern
);
}
}
#[test]
fn test_case_insensitive_wildcard_empty_pattern_indices_within_bounds() {
let test_cases = ["hello", "button.rs", "", "some/path/file.txt"];
for text in test_cases {
let result = match_wildcard_pattern_case_insensitive(text, "");
assert!(result.is_some());
let match_result = result.unwrap();
for &idx in &match_result.matched_indices {
assert!(
idx < text.chars().count(),
"Index {} is out of bounds for text '{}' (length {})",
idx,
text,
text.chars().count()
);
}
assert!(
match_result.matched_indices.is_empty(),
"Empty pattern should produce empty matched_indices, found: {:?}",
match_result.matched_indices
);
}
}
#[test]
fn test_case_insensitive_wildcard_matched_indices_bounds() {
let cases = [
("button.rs", "*.rs"),
("button.rs", "*.r"),
("button.rs", "butto?.rs"),
("button.rs", ""),
("/src/ui/button.rs", "ui/*"),
("/src/ui/button.rs", "ui/*.r"),
];
for (text, pattern) in cases {
if let Some(match_result) = match_wildcard_pattern_case_insensitive(text, pattern) {
let char_count = text.chars().count();
for &idx in &match_result.matched_indices {
assert!(
idx < char_count,
"Pattern '{}' on text '{}': index {} >= char count {}",
pattern,
text,
idx,
char_count
);
}
}
}
}
#[test]
fn test_match_wildcard_case_insensitive_indices_in_bounds() {
let text = "Button.RS";
let pattern = "*.rs";
let result = match_wildcard_pattern_case_insensitive(text, pattern).expect("should match");
assert_eq!(result.matched_indices, vec![6, 7, 8]);
let text_char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(idx < text_char_count);
}
}
#[test]
fn test_match_wildcard_case_insensitive_all_indices_within_bounds() {
let cases = [
("Button.RS", "*.rs"),
("/src/UI/button.rs", "ui/*"),
("/src/ui/button.rs", "ui/*.r"),
("TEST.JS", "test.*"),
("component.tsx", "*.t"),
];
for (text, pattern) in cases {
let result = match_wildcard_pattern_case_insensitive(text, pattern)
.unwrap_or_else(|| panic!("expected match for text='{}', pattern='{}'", text, pattern));
let char_count = text.chars().count();
for &idx in &result.matched_indices {
assert!(
idx < char_count,
"index {} exceeds char count {} for text '{}' and pattern '{}'",
idx,
char_count,
text,
pattern
);
}
}
}
#[test]
fn test_empty_pattern_matched_indices_within_bounds() {
let text = "button.rs";
let text_char_count = text.chars().count();
let result = match_wildcard_pattern(text, "").expect("match result should be present");
for &idx in &result.matched_indices {
assert!(
idx < text_char_count,
"matched index {} out of bounds for text length {}",
idx,
text_char_count
);
}
assert!(result.matched_indices.is_empty());
let result_ci = match_wildcard_pattern_case_insensitive(text, "")
.expect("case insensitive match result should be present");
for &idx in &result_ci.matched_indices {
assert!(
idx < text_char_count,
"matched index {} out of bounds for text length {}",
idx,
text_char_count
);
}
assert!(result_ci.matched_indices.is_empty());
}
#[test]
fn test_no_match_indices_empty() {
let result = FuzzyMatchResult::no_match();
assert_eq!(result.matched_indices, Vec::<usize>::new());
assert_eq!(result.score, 0);
}
#[test]
fn test_find_glob_match_end_bounds() {
let text_chars: Vec<char> = "button.rs".chars().collect();
let pattern_chars: Vec<char> = "button.*".chars().collect();
let end_idx = find_glob_match_end(&text_chars, &pattern_chars, 0);
assert_eq!(end_idx, Some(text_chars.len()));
}
#[test]
fn test_find_glob_match_end_within_text_len() {
let text_chars: Vec<char> = "/src/ui/button.rs".chars().collect();
let pattern_chars: Vec<char> = "ui/*".chars().collect();
if let Some(end_idx) = find_glob_match_end(&text_chars, &pattern_chars, 5) {
assert!(
end_idx <= text_chars.len(),
"find_glob_match_end returned {} which exceeds text length {}",
end_idx,
text_chars.len()
);
}
}
}
A proven fault was caught by a test corral wrote and ran; an unproven one was not, so it may be a missing test or a fault no test can see.
s6/m1 · line 68 proven
- matched_indices: vec![], + matched_indices: vec![usize::MAX],
s1/m1 · line 228 proven
- let matched_indices: Vec<usize> = (start_char_idx..text_char_count).collect(); + let matched_indices: Vec<usize> = (start_char_idx..=text_char_count).collect();
s1/m2 · line 229 proven
- let start_char_idx = text_char_count - suffix_char_count; - let matched_indices: Vec<usize> = (start_char_idx..text_char_count).collect(); + let start_char_idx = text_char_count - suffix_char_count + 1; + let matched_indices: Vec<usize> = (start_char_idx..text_char_count + 1).collect();
s1/m3 · line 238 proven
- if let Some(match_info) = find_partial_suffix_match(text, suffix) {
+ if let Some(mut match_info) = find_partial_suffix_match(text, suffix) {
+ match_info.push(text.chars().count());s1/m4 · line 254 proven
- let prefix_char_count = prefix.chars().count(); + let prefix_char_count = text.chars().count() + 1;
s1/m5 · line 255 proven
- let prefix_char_count = prefix.chars().count();
- let matched_indices: Vec<usize> = (0..prefix_char_count).collect();
- return Some(FuzzyMatchResult {
- score: 1000,
- matched_indices,
+ return Some(FuzzyMatchResult {
+ score: 1000,
+ matched_indices: vec![usize::MAX],s1/m6 · line 266 proven
- if let Some(match_info) = find_substring_glob_match(text, pattern) {
+ if let Some(mut match_info) = find_substring_glob_match(text, pattern) {
+ match_info.push(text.chars().count());s1/m7 · line 275 proven
- let matched_indices: Vec<usize> = (0..text.chars().count()).collect(); + let matched_indices: Vec<usize> = (0..=text.chars().count()).collect();
s4/m2 · line 337 proven
- (start_pos..start_pos + partial_chars.len()).collect(); + (start_pos..start_pos + partial_chars.len()).map(|i| i + 1000).collect();
s4/m1 · line 339 proven
- (start_pos..start_pos + partial_chars.len()).collect(); + (start_pos..start_pos + partial_chars.len() + 1).collect();
s0/m1 · line 423 proven
- matched_indices: (start_idx..remaining_char_count).collect(), + matched_indices: (start_idx..=remaining_char_count).collect(),
s0/m2 · line 438 proven
- matched_indices: (0..remaining_text.chars().count()).collect(), + matched_indices: (0..=remaining_text.chars().count()).collect(),
s0/m3 · line 457 proven
- combined_indices.push(remaining_start_char + idx); + combined_indices.push(remaining_start_char + idx + 1);
s0/m4 · line 462 proven
+ combined_indices.push(text.chars().count());
s0/m8 · line 493 proven
- let matched_indices: Vec<usize> = (start_idx..end_idx.min(text_chars.len())).collect(); + let matched_indices: Vec<usize> = (start_idx..end_idx.min(text_chars.len()) + 1).collect();
s0/m7 · line 495 proven
- let matched_indices: Vec<usize> = (start_idx..end_idx.min(text_chars.len())).collect(); + let matched_indices: Vec<usize> = (start_idx..=text_chars.len()).collect();
s6/m3 · line 520 proven
- Some(text_chars.len()) + Some(text_chars.len() + 1)
s2/m1 · line 543 proven
- return pattern[pattern_idx..].iter().all(|&c| c == '*'); + return pattern[pattern_idx..].iter().any(|&c| c == '*');
s2/m2 · line 551 proven
- if is_glob_match_chars_recursive(text, pattern, text_idx, pattern_idx + 1) {
+ if is_glob_match_chars_recursive(text, pattern, text_idx + 1, pattern_idx + 1) {s2/m3 · line 555 proven
- if is_glob_match_chars_recursive(text, pattern, i + 1, pattern_idx + 1) {
+ if is_glob_match_chars_recursive(text, pattern, i, pattern_idx + 1) {s2/m4 · line 563 proven
- is_glob_match_chars_recursive(text, pattern, text_idx + 1, pattern_idx + 1) + is_glob_match_chars_recursive(text, pattern, text_idx, pattern_idx + 1)
s2/m5 · line 567 proven
- if text[text_idx].eq_ignore_ascii_case(&c) {
+ if !text[text_idx].eq_ignore_ascii_case(&c) {s3/m1 · line 589 proven
- return pattern[pattern_idx..].iter().all(|&c| c == b'*'); + return true;
s3/m2 · line 597 proven
- if is_glob_match_recursive(text, pattern, text_idx, pattern_idx + 1) {
+ if false {s3/m4 · line 609 proven
- is_glob_match_recursive(text, pattern, text_idx + 1, pattern_idx + 1) + is_glob_match_recursive(text, pattern, text_idx, pattern_idx + 1)
s3/m5 · line 614 proven
- if text[text_idx].eq_ignore_ascii_case(&c) {
+ if !text[text_idx].eq_ignore_ascii_case(&c) {s5/m2 · line 647 proven
- return Some(FuzzyMatchResult::no_match()); + let mut result = FuzzyMatchResult::no_match(); + result.matched_indices.push(text.len() + 1); + return Some(result);
s5/m3 · line 659 proven
- .retain(|&idx| idx < text.chars().count()); + .push(text.chars().count() + 100);
s0/m5 · line 475 unproven
- (start_char_idx..start_char_idx + prefix_char_count).collect(); + (start_char_idx..=text.chars().count()).collect();
s0/m6 · line 477 unproven
- let matched_indices: Vec<usize> = - (start_char_idx..start_char_idx + prefix_char_count).collect(); + let mut matched_indices: Vec<usize> = + (start_char_idx..start_char_idx + prefix_char_count).collect(); + matched_indices.push(usize::MAX);
s3/m3 · line 601 unproven
- for i in text_idx..text.len() {
+ for i in text_idx..=text.len() {