first pass of merging in warp (doesn't build)

This commit is contained in:
Ryan Ward
2026-07-01 16:08:58 -05:00
parent 2f64909469
commit 4770ac06b5
3662 changed files with 414574 additions and 89772 deletions
+44
View File
@@ -0,0 +1,44 @@
use crate::prefix::longest_common_prefix;
#[test]
fn test_basic_prefix() {
let strings = ["foo", "foobar", "foofoobar"];
let result = longest_common_prefix(strings);
assert_eq!(result.unwrap(), "foo");
}
#[test]
fn test_no_prefix() {
let strings = ["foo", "foobar", "bar"];
let result = longest_common_prefix(strings);
assert_eq!(result, None);
}
#[test]
fn test_single_string() {
let strings = ["foo"];
let result = longest_common_prefix(strings);
assert_eq!(result.unwrap(), "foo");
}
#[test]
fn test_no_string() {
let strings = [];
let result = longest_common_prefix(strings);
assert_eq!(result, None);
}
#[test]
fn test_multibyte_strings() {
let strings = ["ay東cz", "ay東ab"];
let result = longest_common_prefix(strings);
assert_eq!(result.unwrap(), "ay東");
}
#[test]
fn test_multibyte_strings_common_bytes() {
let strings = ["ab東早", "ab東旪"];
let result = longest_common_prefix(strings);
assert_eq!(result.unwrap(), "ab東");
}