public void BestFoundNotPartial() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List<string> {"the", "there","is"}); int[] breakLocs = tester.BreakResults("thereis"); Assert.True(breakLocs.Length == 2); //we should have found 2 words Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5);//there at index 0, and is at index 5 }
public void BestFoundPunctuationTest() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List<string> { "there", "isn't", "a", "problem", "is", "this", "fail" }); int[] breakLocs = tester.BreakResults("thereisn'tapunctuationproblem,isthere?thisshould'tfailifthereis"); Assert.True(breakLocs.Length == 11); //we should have found thirteen words //there at index 0, isn't at 5, a at 10, is at 61 Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5 && breakLocs[2] == 10 && breakLocs[10] == 61); }
public void BestFoundMoreRobust() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List<string> { "the", "he", "here", "a", "there", "is", "rest", "easy" }); int[] breakLocs = tester.BreakResults("therestiseasy"); Assert.True(breakLocs.Length == 4); //we should have found four words //the at index 0, rest at 3, is at 7, easy at 9 Assert.True(breakLocs[0] == 0 && breakLocs[1] == 3 && breakLocs[2] == 7 && breakLocs[3] == 9); }
public void SkipFalseWholeSentenceWord() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List <string> { "thisisnotaword" }); int[] breakLocs = tester.BreakResults("thisisnotaword"); Assert.True(breakLocs.Length == 0); }
public void BestFoundNotPartial() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List <string> { "the", "there", "is" }); int[] breakLocs = tester.BreakResults("thereis"); Assert.True(breakLocs.Length == 2); //we should have found 2 words Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5); //there at index 0, and is at index 5 }
public void BestFoundPunctuationTest() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List <string> { "there", "isn't", "a", "problem", "is", "this", "fail" }); int[] breakLocs = tester.BreakResults("thereisn'tapunctuationproblem,isthere?thisshould'tfailifthereis"); Assert.True(breakLocs.Length == 11); //we should have found thirteen words //there at index 0, isn't at 5, a at 10, is at 61 Assert.True(breakLocs[0] == 0 && breakLocs[1] == 5 && breakLocs[2] == 10 && breakLocs[10] == 61); }
public void BestFoundMoreRobust() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List <string> { "the", "he", "here", "a", "there", "is", "rest", "easy" }); int[] breakLocs = tester.BreakResults("therestiseasy"); Assert.True(breakLocs.Length == 4); //we should have found four words //the at index 0, rest at 3, is at 7, easy at 9 Assert.True(breakLocs[0] == 0 && breakLocs[1] == 3 && breakLocs[2] == 7 && breakLocs[3] == 9); }
public void DontDieOnLongData() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List<string> { "the", "a", "is", "rest", "easy", "that", "for", "there", "on"}); int[] breakLocs = tester.BreakResults("fourscoreandsevenyearsagoourforefathersbroughtforthonthiscontinentanewnationconcievedinliberty" + "anddedicatedtothepropsitionthatallmenarecreatedequalnowweareengagedinagreatcivilwartestingwhether" + "thatnationoranynationsoconceivedandsodedicatedcanlongendourewearemetonagreatbattlefieldofthatwar" + "wehavecometodedicateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthat" + "nationmightliveitisaltogetherfittingandproperthatweshoulddothisbutinalargersensewecannotdedicate" + "wecannotconsecratewecannothallowthisgroundthebravemenlivinganddeadwhostruggledherehaveconsecrated" + "itfaraboveourpoorpowertoaddordetracttheworldwilllittlenotenorlongrememberwhatwesayherebutitcannever" + "forgetwhattheydidhereitisforusthelivingrathertobededicatedheeretotheunfinishedworkwhichtheywhofought" + "herehavethusfarsonoblyadvanceditisratherforustobeherededicatedtothegreattaskremainingbeforeusthatfrom" + "thesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastfullmeasureofdevotion" + "thatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunderGodshallhaveanewbirth" + "offreedomandthatgovernmentofthepeoplebythepeopleandforthepeopleshallnotperishfromtheearth"); Assert.True(breakLocs.Length == 165); //we should have found 165 words }
public void DontDieOnLongData() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List <string> { "the", "a", "is", "rest", "easy", "that", "for", "there", "on" }); int[] breakLocs = tester.BreakResults("fourscoreandsevenyearsagoourforefathersbroughtforthonthiscontinentanewnationconcievedinliberty" + "anddedicatedtothepropsitionthatallmenarecreatedequalnowweareengagedinagreatcivilwartestingwhether" + "thatnationoranynationsoconceivedandsodedicatedcanlongendourewearemetonagreatbattlefieldofthatwar" + "wehavecometodedicateaportionofthatfieldasafinalrestingplaceforthosewhoheregavetheirlivesthatthat" + "nationmightliveitisaltogetherfittingandproperthatweshoulddothisbutinalargersensewecannotdedicate" + "wecannotconsecratewecannothallowthisgroundthebravemenlivinganddeadwhostruggledherehaveconsecrated" + "itfaraboveourpoorpowertoaddordetracttheworldwilllittlenotenorlongrememberwhatwesayherebutitcannever" + "forgetwhattheydidhereitisforusthelivingrathertobededicatedheeretotheunfinishedworkwhichtheywhofought" + "herehavethusfarsonoblyadvanceditisratherforustobeherededicatedtothegreattaskremainingbeforeusthatfrom" + "thesehonoreddeadwetakeincreaseddevotiontothatcauseforwhichtheygavethelastfullmeasureofdevotion" + "thatweherehighlyresolvethatthesedeadshallnothavediedinvainthatthisnationunderGodshallhaveanewbirth" + "offreedomandthatgovernmentofthepeoplebythepeopleandforthepeopleshallnotperishfromtheearth"); Assert.True(breakLocs.Length == 165); //we should have found 165 words }
public void SkipFalseWholeSentenceWord() { WordBreakGuesserTester tester = new WordBreakGuesserTester(); tester.Init(new List<string> { "thisisnotaword" }); int[] breakLocs = tester.BreakResults("thisisnotaword"); Assert.True(breakLocs.Length == 0); }