Update test cases to deal with new data

This commit is contained in:
Dirkjan Ochtman 2021-06-02 05:23:24 -07:00
parent e89606235b
commit c0e2ddbf46
1 changed files with 50 additions and 39 deletions

View File

@ -7,7 +7,11 @@ pub fn run(segmenter: &Segmenter) {
for test in TEST_CASES.iter().copied() {
success &= assert_segments(test, &mut search, segmenter);
}
success &= assert_segments(FAIL, &mut search, segmenter);
for test in FAILED.iter().copied() {
success &= assert_segments(test, &mut search, segmenter);
}
assert!(success);
}
@ -82,28 +86,6 @@ pub const TEST_CASES: &[&[&str]] = &[
"of",
"foolishness",
],
&[
"as",
"gregor",
"samsa",
"awoke",
"one",
"morning",
"from",
"uneasy",
"dreams",
"he",
"found",
"himself",
"transformed",
"in",
"his",
"bed",
"into",
"a",
"gigantic",
"insect",
],
&[
"in", "a", "hole", "in", "the", "ground", "there", "lived", "a", "hobbit", "not", "a",
"nasty", "dirty", "wet", "hole", "filled", "with", "the", "ends", "of", "worms", "and",
@ -113,8 +95,10 @@ pub const TEST_CASES: &[&[&str]] = &[
],
];
/// Incorrectly segmented, since the test data doesn't contain "unregarded"
const FAIL: &[&str] = &[
/// Incorrectly segmented test cases
const FAILED: &[&[&str]] = &[
&[
// The SCOWL word list (at size 60) data does not contain "unregarded"
"far",
"out",
"in",
@ -140,4 +124,31 @@ const FAIL: &[&str] = &[
"regarded",
"yellow",
"sun",
],
&[
// The SCOWL word list (at size 60) does not contain "gregor"
"as",
"greg",
"or",
"sam",
"s",
"a",
"awoke",
"one",
"morning",
"from",
"uneasy",
"dreams",
"he",
"found",
"himself",
"transformed",
"in",
"his",
"bed",
"into",
"a",
"gigantic",
"insect",
],
];