From bacf82c8cc74948582f8cd2ea5594defc83ee5b1 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 4 Feb 2021 10:40:45 +0100 Subject: [PATCH] Separate incorrect segmentation out of TEST_CASES --- src/test_cases.rs | 57 +++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/src/test_cases.rs b/src/test_cases.rs index a915766..2ed9076 100644 --- a/src/test_cases.rs +++ b/src/test_cases.rs @@ -5,6 +5,7 @@ pub fn run(segmenter: &Segmenter) { for test in TEST_CASES.iter().copied() { assert_segments(segmenter, test); } + assert_segments(segmenter, FAIL); } pub fn assert_segments(segmenter: &Segmenter, s: &[&str]) { @@ -96,31 +97,33 @@ pub const TEST_CASES: &[&[&str]] = &[ "nothing", "in", "it", "to", "sit", "down", "on", "or", "to", "eat", "it", "was", "a", "hobbit", "hole", "and", "that", "means", "comfort", ], - &[ - "far", - "out", - "in", - "the", - "uncharted", - "backwaters", - "of", - "the", - "unfashionable", - "end", - "of", - "the", - "western", - "spiral", - "arm", - "of", - "the", - "galaxy", - "lies", - "a", - "small", - "un", - "regarded", - "yellow", - "sun", - ], +]; + +/// Incorrectly segmented, since the test data doesn't contain "unregarded" +const FAIL: &[&str] = &[ + "far", + "out", + "in", + "the", + "uncharted", + "backwaters", + "of", + "the", + "unfashionable", + "end", + "of", + "the", + "western", + "spiral", + "arm", + "of", + "the", + "galaxy", + "lies", + "a", + "small", + "un", + "regarded", + "yellow", + "sun", ];