Rust panics with
thread 'test_nok' panicked at 'attempt to multiply with overflow', src/search.rs:256:40
on longer strings. Maybe somewhat surprisingly, both the query as well as the search string seem to contribute to this panic.
#[test]
fn test_ok() {// base, works
let s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
score(s, "ABCDE");
}
#[test]
fn test_ok2() {// s increased by one, query reduced by one, still works
let s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890A";
score(s, "ABCD");
}
#[test]
fn test_panic() {// s increased by one, query left as is, panics
let s = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890A";
score(s, "ABCDE");
}
I'm not sure whether only short strings are supported or this is a legit bug.
Rust panics with
thread 'test_nok' panicked at 'attempt to multiply with overflow', src/search.rs:256:40
on longer strings. Maybe somewhat surprisingly, both the query as well as the search string seem to contribute to this panic.I'm not sure whether only short strings are supported or this is a legit bug.