Skip to content

Instantly share code, notes, and snippets.

@dulimarta
Last active January 29, 2016 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dulimarta/465f32eddb7d2334d727 to your computer and use it in GitHub Desktop.
Save dulimarta/465f32eddb7d2334d727 to your computer and use it in GitHub Desktop.
CS263 text predictor unit testing
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <iostream>
#include "TextPredictor.h"
using namespace std;
TEST_CASE ("Scan") {
vector<pair<string,vector<string>>> expected_follower {
{"ability", {"to","when"}},
{"about", {"it","the","that","him","his","something","a","in","to","you","how","me","on","them","concluded","he","much","project","until","again","all","an","and","announced","any","by","doing","done","eh","etexts","everything","five","having","made","marveled","my","myself","next","one","ready","right","running","seven","slowly","so","some","stop","ten","there","they","this","those","three","time","twenty","two","watching","what","while","with","working","your"}},
{"above", {"the","disclaimers","his","landing","was"}},
{"accident", {"had","he","almost","always","came","i","in","just","mr","related","they","was"}},
{"across", {"the","his","him","my","one","to"}},
{"act", {"was","i","that","is","of","and","by","in","to","with","you","announced","as","at","attentively","back","even","falls","for","going","had","he","it","lacked","ladies","mademoiselle","might","mr","not","on","out","proceeded","quickly","really","started","taking","tonight","what","which","without"}},
{"acts", {"about","i","in","of","rather","the","to","were"}},
{"advice", {"i","mr","or","some","teddy","while","you"}},
{"afraid", {"of","they","behave","hold","i","my","not","something","there","to","you"}},
{"after", {"a","the","having","he","that","this","you","school","them","they","which","me","reaching","some","all","another","attending","bathing","closing","consulting","daylight","disentangling","disposing","eight","finishing","getting","greeting","helping","his","i","it","listening","looking","many","midnight","mr","my","others","placing","putting","reading","returning","saving","she","snarl","something","teddy","we","years"}},
{"afterwards", {"all","characterized"}},
{"against", {"the","a","which","him","his","my","one","that"}},
{"ahead", {"of","and","however","in","just","we"}},
{"all", {"right","the","about","at","of","that","his","over","day","this","through","to","fours","i","night","ready","they","you","around","he","liability","manner","my","other","there","those","your","a","amounts","are","back","be","before","books","business","but","control","crippled","danger","donations","dressed","during","elephants","except","eyes","fear","get","gone","grinned","h","hands","huh","human","hurry","important","in","inside","it","just","might","moments","mud","no","occurred","on","our","out","parts","phil","probability","project","proportion","running","sides","sleep","so","speed","summer","thank","then","these","think","together","trades","walked","was","who","winter","young","yourself"}},
{"almost", {"as","at","in","the","brutally","from","go","incredibly","solely","sternly","straight","threw","to","too","unreal","up","wholly"}},
{"along", {"the","as","with","and","at","by","come","decided","famously","he","i","in","later","now","on","phil","thank","they","urged","without","you","young"}},
{"already", {"had","the","there","a","at","did","eaten","hardly","have","i","look","no","people","put","reached","recognized","settled","show","teddy","those","use","was"}},
{"also", {"download","provide","sit","tells"}},
{"always", {"be","got","around","casts","cats","did","do","entered","gathered","had","has","is","made","make","obeyed","opportunities","run","something","tell","took","unless","want","wanted"}},
{"amused", {"interest","smiles"}},
{"amusedly", {"the"}},
{"analyzed", {"the"}},
{"ancient", {"style"}},
{"anger", {"of","over"}},
{"angered", {"beyond","the"}},
{"angry", {"about","at","before","but","demands","disapproval","eyes","gleam","imprecations","snarl","voice"}},
{"anonymous", {"password"}},
{"another", {"turn","and","armless","direction","drink","i","instant","is","loud","part","roar","scene","state","swing","swinging","team","thing","tomorrow","tune","wagon","was"}},
{"answer", {"at","come","he","here","him","one","should","that","to","what"}},
{"anybody", {"could","in","any","d","else","gone","knows","living","should"}},
{"anyhow", {"twilight"}},
{"anyone", {"appear","don","else","how","i","knew","should","to","who"}},
{"anything", {"else","in","of","that","you","about","i","it","they","to","wrong","against","and","behind","except","for","grunted","had","happen","if","knows","like","on","smiled","so","tasted","thundered","unusual","was","with","worthwhile"}},
{"appeared", {"to","in","almost","as","at","even","fully","going","out","through"}},
{"appearing", {"to","above"}},
{"appetite", {"all"}},
{"appetites", {"that"}},
{"applaud", {"he"}},
{"applauded", {"the"}},
{"applauding", {"he"}},
{"applause", {"the","did","swept"}},
{"applicable", {"taxes"}},
{"applied", {"himself","themselves"}},
{"approached", {"the","abner","any","to"}},
{"approaching", {"had","i","the"}},
{"approval", {"of","all","and","boy","fine","the","their"}},
{"approvingly", {"give","they","when"}},
{"are", {"you","not","going","a","the","they","getting","liable","now","to","too","all","always","in","just","made","only","ready","two","able","accusing","aching","an","available","bending","changing","didn","eh","evil","final","first","full","gone","having","laughed","laying","like","listed","living","looking","many","mistaken","more","my","naturally","new","numbered","over","payable","place","planning","playing","pretty","revengeful","right","sharp","sleeping","snapped","so","some","tax","that","their","there","told","up","using","usually","very","watching","willing","with","worthwhile"}},
{"aren", {"t"}},
{"arena", {"again","chapter","fall","following","get","in","ix","ready","teddy","the","to"}},
{"argument", {"i","with"}},
{"arm", {"and","had","hanging","his","in","most","on","phil","the","was","what"}},
{"arrived", {"and","for","having","there","to"}},
{"as", {"he","if","the","a","it","they","to","well","much","you","phil","i","soon","his","an","we","on","possible","that","any","anyone","best","far","fast","for","from","good","had","handsome","is","long","not","quickly","soundly","two","was","actually","anybody","anything","big","chore","curiosity","did","different","disconsolate","distinguished","either","emperor","ever","everybody","fit","friends","graceful","handily","high","horseflesh","in","loud","mademoiselle","many","meekly","motionless","none","one","only","please","powerless","properties","quick","rapidly","rodney","rough","says","school","several","she","skillfully","skinning","statues","successful","tcb","teddy","their","this","thoroughly","those","though","trustee","unerringly"}},
{"ask", {"me","you","for","him","the","them","what","about","mr","that"}},
{"assistant", {"as","grinned","had","humorously","laughed","made","manager","motioned","returned","the","was","what","who","whom","with"}},
{"at", {"the","once","his","that","a","all","first","this","least","home","it","such","last","hand","him","me","one","them","work","carnegie","length","no","school","teddy","whatever","you","abner","about","an","breakfast","edmeston","express","full","http","jeered","midnight","mr","noon","our","rather","s","seven","some","something","sternness","supper","thought","times","top","us","which"}},
{"ate", {"dinner"}},
{"attempt", {"to","at","his","that"}},
{"away", {"from","and","to","as","on","phil","this","almost","by","i","in","teddy","the","with","asked","but","center","decided","he","it","once","one","pointing","smiling","sorrowfully","that","today","toward","without"}},
{"back", {"to","of","in","and","with","here","on","the","into","a","against","as","it","there","after","again","asked","at","cried","door","ever","every","everybody","fearing","had","head","i","instinctively","just","landing","now","over","slapping","that","too","twinkled","under","uttering","when","which","while","will"}},
{"bad", {"habits","as","boy","ending","grumbled","haven","he","how","idea","if","medicine","most","place","speculation","spells","thing","you"}},
{"bag", {"of","on","that","and","from","he","i","is","lying","snapped","with"}},
{"baggage", {"wagon","as","over","there","uncle","was"}},
{"bailey", {"will"}},
{"balance", {"on"}},
{"band", {"wagon","struck","was","and","bring","crash","i","inside","itself","launched","now","of","platform","playing","striking","swung","too","who","with"}},
{"bareback", {"act","riding"}},
{"barn", {"door","said"}},
{"barrels", {"be","guess"}},
{"barren", {"deserted","strip"}},
{"bars", {"of","against","and","at","bengal","chapter","he","on","with"}},
{"based", {"on"}},
{"basket", {"to","tucked"}},
{"bass", {"drums","horn"}},
{"be", {"a","able","all","the","afraid","an","glad","in","likely","no","ready","so","surprised","willing","better","careful","done","good","jealous","killed","left","on","over","phil","right","sure","used","about","any","back","but","discovered","fine","getting","great","lost","more","observed","off","outdone","plumped","pretty","quiet","seen","thanked","to","unable","up","after","allowed","alone","along","among","and","apt","around","aroused","aware","away","backward","behind","best","broken","brought","burning","christmas","circus","committing","continued","cranky","disappointed","dishonorable","disturbed","down","dragged","easily","ended","enough","everlastingly","expecting","fifty","floating","for","frightened","full","going","handy","hard","harmed","heard","his","home","idle","impudent","it","kept","late","learned","leaving","light","lightly","like","lively","loaded","long","lucky","mad","made","making","mighty","moved","mr","named","nodded","of","our","paid","part","pitched","pleasantly","possible","posted","prepared","published","pulling","punctured","put","putting","quick","quite","read","readily","robbed","safe","satisfied","sleeping","soaked","some","sore","sorry","spread","standing","still","such","teddy","telling","that","there","this","thousands","thrown","tightening","time","told","too","trampled","true","uneasy","walked","wanting","warmer","wetter","with","working","worse","worthwhile","wrenched","wrong","you"}},
{"bearings", {"and"}},
{"beast", {"s","uttering","with","and","at","don","emperor","for","had","in","let","on","phil","released","steady","taking","the","through","to","uttered","whirled"}},
{"beastly", {"weather"}},
{"bed", {"all","and","as","at","clothes","down","dropped","he","holding","i","if","now","said","that","this"}},
{"been", {"in","doing","done","a","hurled","thinking","able","finished","fired","forced","going","heard","his","living","piled","placed","practicing","so","the","thrown","trying","working","advertised","afraid","all","an","angry","around","aroused","at","attached","attracted","badly","breathed","brought","busy","but","called","cared","carried","caused","chopping","cut","dead","delivered","demanded","devised","downtown","drawn","driven","eating","erected","fastened","fixed","formed","hit","hunting","hurt","i","kicking","killed","laid","making","much","nothing","occupied","of","on","one","otherwise","out","packed","paralyzed","passed","performing","pitched","present","propped","resting","rigged","scribbled","shivering","shunting","standing","struck","supposed","swept","taken","talked","tearing","that","thought","threatening","to","too","torn","up","wanting","watching","wholly","worse","worth","young"}},
{"before", {"the","you","him","i","he","it","they","breakfast","had","in","she","them","we","and","come","daybreak","daylight","did","don","jumbo","many","mr","of","once","phil","posting","school","succeeding","taking","this","why","with"}},
{"beforehand", {"end"}},
{"befriend", {"old"}},
{"beg", {"your"}},
{"began", {"to","a","their","blowing","catch","crowding","emerging","hopping","hunting","its","measuring","moving","pacing","putting","rapidly","reaching","slowly","swinging","the","wiping","working"}},
{"begged", {"the"}},
{"begging", {"that"}},
{"begin", {"but","by","hunting","making","on","phil","today","tomorrow"}},
{"beings", {"as","but","like"}},
{"believe", {"i","that","he","his","huh","it","were","you"}},
{"besides", {"that","a","building","furnish","he","nobody","the","what","you"}},
{"best", {"of","drawing","he","advantage","as","clothes","ever","flying","foot","known","part","place","places","thing","things","way","we"}},
{"better", {"than","be","look","run","get","go","he","not","take","what","able","after","and","attach","begin","business","but","do","editing","examination","example","exercise","find","fire","h","have","in","man","phil","put","resend","say","showman","speak","stay","suited","the","to","view","wait","wear","when","yes"}},
{"between", {"the","bengal","his","meals","seasons","two","you"}},
{"beyond", {"his","endurance","enjoying","the","words"}},
{"bit", {"of","unsteadily","as","but","had","how","these","urged"}},
{"books", {"at","down","e","gutenberg","huh","i","in","information","next","one","placed","strapped","that","to","under"}},
{"boss", {"canvasman","will","is","wants","a","does","don","eh","had","has","isn","no","s","sparling"}},
{"bossing", {"the"}},
{"both", {"hands","boys","lads","phil","of","to","arms","be","beasts","become","come","could","for","humans","performances","sets","thank","the","think","were","when"}},
{"break", {"your","the","through","any","his","in","it","kennedy","occurred","their","until","up"}},
{"breakfast", {"then","call","reaching","seven","somehow","take","well"}},
{"breaking", {"away","in","of","on","up"}},
{"brightness", {"get"}},
{"brilliant", {"blanket","ribbon"}},
{"circus", {"boys","boy","lot","man","people","tent","men","performer","grounds","bill","business","comes","he","is","life","after","arena","band","bands","being","billboard","career","folks","i","ii","it","just","land","mrs","no","or","parade","parlance","performance","performers","put","so","soon","tomorrow","too","uncle","unless","wait","was","watch","were","what","which","with","woman","world","wouldn","yes","you"}},
{"circuses", {"and","before"}},
{"clothes", {"and","to","today","when","carrying","consisting","demanded","for","handing","he","i","phil","this","though","throwing","was","were","yes"}},
{"clothing", {"he","hung"}},
{"clown", {"s","i","in","makeup","mr","ran","act","and","as","came","clapping","commanded","dodged","does","face","fix","his","if","jabbed","launched","looks","make","noting","off","phil","shaking","significantly","stepped","take","than","thank","that","until","you"}},
{"clowns", {"wagon","and","band","hop","hurrying","in","launched","looked","not","on","picked","piled","were","you"}},
{"coat", {"and","pocket","with","a","but","chapter","he","sleeve"}},
{"coffee", {"boy","back","boiler","drawer","good","he","here","in","my","that","the","too","was"}},
{"comes", {"to","a","along","back","down","here","on","out","the"}},
{"comfortable", {"look","sleeping"}},
{"companion", {"and","s","a","about","admiringly","for","go","he","just","no","of","phil","surveyed","though","until","was","whistled","whom","will","with"}},
{"companions", {"and","shouted","to"}},
{"could", {"not","do","be","get","find","have","lay","scarcely","hear","i","see","a","almost","also","averred","behave","chop","crawl","determining","distinguish","double","draw","eat","fill","finishing","fly","give","go","make","plainly","prick","put","remember","run","she","stand","thaw","the","they","understand","walk","wash"}},
{"crowd", {"arrives","back","but","closed","getting","had","handsome","hurling","i","of","shouted","that","understanding"}},
{"days", {"of","before","came","passed","you","and","at","boys","but","concussion","depending","followed","following","that","they","to","turned","under","was","will"}},
{"demanded", {"mr","phil","the","changing","i","somewhat","teddy","with"}},
{"dizzy", {"again","but","tell","that","when"}},
{"dobbsville", {"ohio"}},
{"download", {"our"}},
{"educated", {"mule"}},
{"education", {"as","i","what","when"}},
{"elbows", {"and"}},
{"electronic", {"path","texts"}},
{"elevated", {"position"}},
{"enough", {"to","for","he","of","boys","going","how","in","maybe","money","rodney","school","the","was","when","where","you"}},
{"except", {"a","after","himself","our","talk","what","when","where"}},
{"fairly", {"howled","holding","made","dragging","fly","launched","leaped","shouted","started"}},
{"fellow", {"over","was","who","continued","don","has","he","i","in","is","performer","s","said","tame","to","you"}},
{"fetch", {"a","his","the"}},
{"few", {"minutes","moments","days","hours","of","belongings","feet","lumps","men","more","road","rods","seconds","tear","weeks"}},
{"find", {"out","something","a","it","that","the","business","him","mr","my","no","places","to","two","you","your","yourself"}},
{"foot", {"of","after","and","clawing","come","dive","down","free","had","he","if","into","is","phil","what","with","you"}},
{"forget", {"it","all","as","in","that","the","to","you","your"}},
{"further", {"conversation","end","than","the","attention","before","damage","incident","information","need","orders","protest","questions","up","use"}},
{"gets", {"a","in","ahead","bad","cool","sight","to","well"}},
{"glistening", {"spangles","trains"}},
{"gold", {"but","lace"}},
{"golden", {"cloud"}},
{"gone", {"for","on","crazy","clear","daffy","far","he","home","in","more","suddenly","the","they","to","when","wrong","yet"}},
{"good", {"for","bye","fortune","natured","naturedly","thing","to","act","clown","idea","many","morning","news","night","stunt","time","yes","a","advertisement","advice","as","attendance","bit","care","church","circus","cried","enough","fun","grinned","healthy","hearted","house","humor","imitation","impression","joke","laughed","look","might","nature","now","old","on","one","opportunity","plan","riddance","seats","that","understudy","woman"}},
{"goodbye", {"emperor"}},
{"goods", {"box"}},
{"grounds", {"alone","four","men","of","several","where","with"}},
{"halfway", {"across","there","through"}},
{"head", {"to","clown","and","harness","of","as","gear","in","was","after","came","first","had","he","i","it","not","on","once","taller","without","you","about","against","anybody","bobbing","disappeared","doubtfully","down","dragging","erect","from","gazing","indifferently","landing","laughed","level","like","narrowly","next","off","phil","rebuked","revealing","standing","struck","teddy","the","them","they","toward","under","went","when","where","while","whirl","whirling","yelling","yes"}},
{"heard", {"the","from","of","a","and","him","that","all","gave","how","last","me","mr","no","on","or","other","voices"}},
{"hide", {"of","emperor","phil","was"}},
{"high", {"in","up","as","at","class","dive","gazing","good","pitch","priced","seat","something","that"}},
{"hit", {"a","another","decided","for","him","i","it","of","see","that","then","well","xv","you"}},
{"horses", {"and","added","clearing","drawing","driven","i","let","on","performing","to","were","with"}},
{"hotel", {"hadn","he","i","office","where"}},
{"hour", {"i","or","are","but","had","later","never","of","s","then","this","two","we","when","while"}},
{"hours", {"before","to","answered","drew","his","phil"}},
{"house", {"and","where","a","abner","bag","but","going","phil","that","tonight","without"}},
{"hundred", {"million","and","dollars","has","less","seats","you"}},
{"hurrah", {"shouted"}},
{"hurried", {"back","to","on","away","from","into","over","toward","trips"}},
{"hurry", {"and","about","don","him","jumbo","stop","that","to"}},
{"hurrying", {"to","along","away","by","past"}},
{"hurt", {"he","i","again","answered","asked","but","if","in","kennedy","me","much","no","thanks","that","the","they","though"}},
{"idea", {"i","of","we","about","in","it","phil","reflected","suppose","that","was","where","who","you"}},
{"if", {"you","i","he","they","the","it","we","there","emperor","his","a","any","anything","every","in","mr","my","that","your","abner","angry","drawn","enraged","necessary","no","none","not","one","our","phil","pondering","possible","signor","these","this","those","to","uncertain","utterly","wallace","what"}},
{"information", {"about","by","in","is","on","prepared","that"}},
{"interest", {"in","a","and","as","for","he","that","they","to","was"}},
{"isn", {"t"}},
{"jumbo", {"s","the","had","always","began","burst","could","ducked","eluded","espying","however","humped","launched","or","shook","suddenly","to","took","while","with"}},
{"keeper", {"but","came","had","place","soon","that","they","well","who"}},
{"knocking", {"all","this"}},
{"least", {"i","idea","not","expect","homeless","mistake","one","phil","question","that","the","thing","to","trouble"}},
{"limp", {"body","unconscious"}},
{"line", {"in","and","at","before","having","of","so","threatening","to","transforming","up"}},
{"lines", {"for","in","moving"}},
{"lost", {"his","all","no","already","as","before","if","some","the"}},
{"make", {"a","the","his","up","you","any","himself","it","your","against","all","as","coffee","he","him","its","me","more","much","out","some","sure","that","this","way","yourself"}},
{"midnight", {"central","hour","of","so"}},
{"momentum", {"of","the"}},
{"moonless", {"but"}},
{"natural", {"born","brightness","expression","or","showman"}},
{"observed", {"that","almost","him","huh","occupied","teddy","the","to","what"}},
{"opportunity", {"to","came","i","presented","there","with","you"}},
{"ordinarily", {"interested","possessed","the"}},
{"parade", {"was","that","and","breaks","coming","doing","had","i","it","keeping","oh","s","see","started","starts","the","to","today","went","who"}},
{"placing", {"a","himself","his","some","the"}},
{"plain", {"ascii","business","vanilla"}},
{"pleased", {"smile","for"}},
{"pockets", {"he","and","better","that","there","were","where"}},
{"point", {"of","where","already","and","h","him","phil","stripping"}},
{"pointed", {"phil","to"}},
{"pointing", {"significantly"}},
{"pole", {"at","to","which","with","and","bent","between","from","he","it","on","she","taking","the","understand","up","wagon","was"}},
{"pretty", {"much","well","big","bill","expert","fair","fine","graceful","narrow","near","soon","spectacle"}},
{"question", {"the","an","and","as","at","came","for","held","just","was","what"}},
{"ran", {"to","down","for","full","in","out","swiftly","across","all","as","away","by","his","lightly","off","on","over","plump","teddy","until","with"}},
{"real", {"circus","horsemen","cloud","facts","funding","hardships","home","live","money","performer","start","stunt"}},
{"road", {"that","the","and","as","before","but","for","from","he","in","show","shows","there","till","with"}},
{"running", {"toward","as","down","fire","his","start","the","this","to","up"}},
{"sahara", {"desert"}},
{"said", {"the","phil","it","he","mr","my","would","a","and","anything","at","chapter","come","his","i","kennedy","laying","more","quietly","so","starting","teddy","that","they","turning","whether"}},
{"season", {"he","i","the","and","drew","they","think","whether","you"}},
{"serious", {"a","accusation","an","expression","injury","phil"}},
{"should", {"be","like","say","have","think","get","prefer","rather","want","appreciate","conclude","do","feel","go","grow","he","need","not","phil","reach","see","take","the","try","turn"}},
{"shows", {"that","boyertown","but","came","from","he","jailed","or","pretty","than","understand","was"}},
{"shrank", {"back"}},
{"side", {"of","and","pole","poles","to","wall","appearing","at","blacksmith","brought","but","by","disconsolately","kept","or","show","sir","splitting","streets","that","there","they","threatening","up","walls","was"}},
{"since", {"i","the","they","you","but","he","lost","mother","of","our","phil","returning","talking","their","these","to","your"}},
{"sleep", {"in","when","as","at","decided","doctor","don","fine","he","i","if","last","on","same","that","the","watching","way","wherever","wondered"}},
{"some", {"of","sort","more","other","sense","chores","folks","little","others","wood","advice","bad","beastly","bends","blankets","bore","breakfast","changes","characters","clever","clothes","comfort","days","decent","different","disagreeable","dishes","distance","elephants","few","further","heavy","hours","human","i","lazy","leaping","long","means","men","money","natural","new","peanuts","person","poles","pretty","real","replied","said","salt","six","states","strange","straw","sugar","task","things","time","trinkets","use","water","well"}},
{"someone", {"else","in","all","and","announced","might","on","other","picked","run","there","touched","we","what","when"}},
{"something", {"to","else","that","was","and","for","about","had","happened","in","of","on","where","akin","at","before","below","besides","bigger","but","ever","i","less","like","more","not","or","s","someday","still","then","thrilling","tonight","tugging","until","unusual","up","warm","wrong"}},
{"stand", {"up","back","here","in","it","and","at","by","for","most","on","still","there","whether"}},
{"standing", {"in","on","there","about","almost","back","before","by","facing","high","hunched","motionless","near","out","women"}},
{"stick", {"and","as","desperately","he","hurts","now","over","the","to","up","when","your"}},
{"stood", {"up","about","a","at","full","gaping","helpless","him","his","in","irresolute","like","mr","not","off","on","phil","poised","quietly","regarding","sleeping","still","this","waiting","when","with"}},
{"streaks", {"on","of"}},
{"stream", {"of","cut","regardless","where"}},
{"strong", {"determination","grip","hasp","healthy","resolute","slender","sunlight"}},
{"such", {"a","as","times","person","accidents","an","announcement","close","damages","places","surprising","time","trouble","was","worthless"}},
{"suddenly", {"the","a","appeared","appearing","collapsed","crazy","decided","dizzy","emperor","gone","he","imbued","made","recovering","that","they","to"}},
{"sue", {"us"}},
{"suggest", {"what"}},
{"suit", {"besides","but","for","i","is","looked","of","though","yourself"}},
{"surgeon", {"did","nodded","after","drew","s","should","that","used","was","were","wheeled","who","worked"}},
{"surprise", {"you","and","appeared","cautiously","emperor","let","sufficiently","that","there","to","where","xi"}},
{"surprised", {"to","chuckled","i","if","inquiry","me","though"}},
{"sympathetic", {"silence"}},
{"than", {"a","ever","to","the","any","that","it","you","anything","phil","some","they","all","already","an","before","bengal","emperor","falling","five","had","half","have","he","hungry","i","in","james","jim","men","navaro","ordinarily","otherwise","see","st","teddy","think","thirty","this","those","three","time","twenty","two","us","usual","was"}},
{"thaw", {"out"}},
{"theory", {"demonstrated","false","he","into"}},
{"thing", {"that","about","as","the","to","we","and","are","at","don","for","go","happen","how","is","like","no","of","or","over","right","thankful","was","when","where","you"}},
{"things", {"that","this","to","and","began","coming","defects","don","he","how","i","in","sir","than","were","why","you"}},
{"tiger", {"s","are","at","back","bengal","cage","has","i","in","is","just","phil","would"}},
{"trunk", {"curled","that","about","and","emperor","in","the","which","around","at","but","came","encircling","escorted","full","grasped","guess","had","mr","not","of","open","peering","phil","right","slowly","somebody","they","to","uncurled","was","when","while"}},
{"turn", {"away","a","and","out","them","about","as","at","his","in","into","it","me","now","off","or","over","teddy","to","you"}},
{"uncle", {"abner","i","had","he","s","uncle","who","would","a","and","asked","brought","compelling","decided","do","for","maybe","mean","more","not","of","protested","reminded","save","send","turned","warned","was","when","will","you"}},
{"until", {"the","he","it","they","his","i","you","a","late","school","their","an","emperor","every","evil","finally","full","help","just","only","pandemonium","payday","seven","sometime","such","tomorrow"}},
{"use", {"to","in","of","a","any","ftp","his","if","mr","or","that","the","them","use","yes"}},
{"various", {"attitudes","length","sites","stages","strange"}},
{"very", {"much","good","well","hard","minute","soon","sorry","thing","beginning","but","comforting","existence","happy","humph","kind","little","lot","proud","quiet","short","wonderful"}},
{"wagon", {"and","had","no","the","was","after","if","it","that","they","which","with","a","all","an","anybody","anyway","being","but","by","chapter","depends","go","i","isn","jabbering","moved","on","out","over","phil","right","sat","show","so","stopped","teddy","to","tonight","too","very","wheel","when","where"}},
{"wagons", {"and","began","that","besides","come","cried","get","go","in","moved","mr","of","others","roll","rumbling","they","to","were","while","with"}},
{"waving", {"his","a","from","undulating"}},
{"well", {"as","i","you","maybe","well","with","yes","and","no","perhaps","reflected","satisfied","what","a","back","boys","could","did","do","don","done","down","fellows","for","go","had","have","help","if","knew","muscled","mused","never","of","pleased","several","since","then","uncle","understood","why","young"}},
{"white", {"and","city","counterpane","expectant","horses"}},
{"would", {"be","have","not","you","rather","catch","prefer","come","do","find","give","go","i","let","pay","say","take","all","and","as","at","become","break","carry","collapse","did","dismount","drive","earn","enter","fall","get","happen","if","improve","in","it","look","make","mount","mused","never","next","object","or","pour","put","reach","see","send","shake","soon","spring","start","steer","swing","tell","tend","think","too","turn","want"}},
{"years", {"since","and","before","but","dark","here","however","older","performers","so","the","there","when"}},
{"yesterday", {"afternoon","oh","will"}},
{"yonder", {"i","where"}},
{"yourself", {"a","don","then","there","and","believe","but","from","growled","in","it","mr","now","out","that","the"}},
{"zip", {"corrected","files","when"}}
};
TextPredictor tp;
#error YOU MUST CHANGE THIS PATH TO MATCH YOUR OWN PERSONAL SETTING
#error REMOVE THESE LINES AFTER YOU FIX THE PATH
ifstream input ("/replace/this/with/the/absolute/path/to/circusboys.txt");
tp.scanWordsFrom(input);
SECTION ("Test correct follower count") {
for (auto& x : expected_follower)
{
auto result = tp.wordsAfter(x.first);
REQUIRE (result.size() == x.second.size());
}
}
SECTION ("Follower word must be match") {
for (auto& x : expected_follower)
{
auto result = tp.wordsAfter(x.first);
for (auto word : x.second) {
auto iter = find (result.begin(), result.end(), word);
REQUIRE (iter != result.end());
}
}
}
SECTION ("Follower word must be sorted by frequency") {
for (auto& x : expected_follower)
{
auto result = tp.wordsAfter(x.first);
REQUIRE (result == x.second);
}
}
vector<pair<string, vector<string>>> prefix_tester{
{"ac", {"act","across","accident","acts","accompanied","accompaniment","account","active","ached","achievement","activity","actually","accept","accepts","access","accidents","accommodating","accommodations","accomplish","accomplishing","according","accusation","accusing","aches","aching","acquaint","acquaintance","acquainted","acre","acrobat","acted","acting","action","activities"}},
{"acc", {"accident","accompanied","accompaniment","account","accept","accepts","access","accidents","accommodating","accommodations","accomplish","accomplishing","according","accusation","accusing"}},
{"acco", {"accompanied","accompaniment","account","accommodating","accommodations","accomplish","accomplishing","according"}},
{"accom", {"accompanied","accompaniment","accommodating","accommodations","accomplish","accomplishing"}},
{"act", {"act","acts","active","activity","actually","acted","acting","action","activities"}},
{"acti", {"active","activity","acting","action","activities"}},
{"alt", {"altogether","alternatively","alter","alteration","alternately","although"}},
{"any", {"any","anything","anybody","anyone","anyway","anywhere","anyhow"}},
{"app", {"appeared","approval","apparatus","appearance","approached","appearing","applause","apparent","apparently","appear","approaching","approvingly","applied","apply","appreciation","appeal","appealed","appealing","appetite","appetites","applaud","applauded","applauding","apple","applicable","appointed","appreciate","appreciative","apprehension","approach","approve","approved","approving"}},
{"appl", {"applause","applied","apply","applaud","applauded","applauding","apple","applicable"}},
{"appr", {"approval","approached","approaching","approvingly","appreciation","appreciate","appreciative","apprehension","approach","approve","approved","approving"}},
{"arm", {"arm","arms","armless","armed","armor","armored"}},
{"at", {"at","attention","attendant","attempt","attendants","attracted","attack","attendance","ate","attach","attached","attaching","attacks","attempting","attempts","attended","attending","attentively","attitudes","attract","attraction","attractions"}},
{"att", {"attention","attendant","attempt","attendants","attracted","attack","attendance","attach","attached","attaching","attacks","attempting","attempts","attended","attending","attentively","attitudes","attract","attraction","attractions"}},
{"atta", {"attack","attach","attached","attaching","attacks"}},
{"attac", {"attack","attach","attached","attaching","attacks"}},
{"ba", {"back","band","bad","bag","bars","baggage","badly","bands","bank","backward","backwards","bandstand","bar","bareback","barn","barrels","barren","basket","bass","bath","bathing","battle","babe","backed","backing","backs","bailey","balance","bandmaster","bang","barnum","barrel","based","baton","bawl"}},
{"bac", {"back","backward","backwards","backed","backing","backs"}},
{"beg", {"began","begin","beginning","begun","begged","beginner","begrudgingly","beg","begging","begins","begone"}},
{"brea", {"break","breathed","breakfast","breath","breaking","breathing","breach","breadth","breaks","breast","breasts","breaths"}},
{"bri", {"bright","brief","bring","brilliant","bridle","briefly","brightly","brightness","brilliantly","bringing","brisk","bristled"}},
{"cal", {"called","call","calm","calico","calling","calliope","calmly","calculate","calculated","calls"}},
{"call", {"called","call","calling","calliope","calls"}},
{"can", {"can","canvas","canvasman","cane","canvasmen","candle","cannon","cannot","canton"}},
{"car", {"care","carriage","carnegie","carried","carry","carrying","carpenter","careful","cartwheel","card","cards","career","cartridge","car","cared","careers","carefree","carefully","carelessly","caressing","caring","carpet","carries","cars"}},
{"cau", {"caught","cause","caused","cautioned","cautiously","caution","causing"}},
{"ce", {"center","certainly","certain","cents","centered","ceased","cemetery","central","certainty","cessation","cessing"}},
{"chai", {"chair","chain","chained","chains","chairs"}},
{"cho", {"chores","chorus","choose","chop","chopping","chops","chore","chorused","chosen"}},
{"circ", {"circus","circuit","circle","circuses","circles","circulating"}},
{"cl", {"clown","clothes","clowns","close","closed","clock","cloud","clear","climbed","clad","clatter","climbing","clouds","class","classes","clawing","client","climax","clinging","closer","clothed","clothing","clouding","clumsy","clung","clapped","clapping","clasped","claw","clawed","claws","clearing","clearly","clerk","clever","click","climb","closely","closes","closing","clover","club","clubs","clutching"}},
{"clu", {"clumsy","clung","club","clubs","clutching"}},
{"coa", {"coat","coach","coachman","coating","coats"}},
{"col", {"color","cold","collection","collapsed","collapse","collar","collections","collided","colored","colors"}},
{"coll", {"collection","collapsed","collapse","collar","collections","collided"}},
{"com", {"come","companion","coming","comes","combined","command","com","commanded","comments","commands","companions","computer","comfortable","comment","company","compass","complaining","complete","comanche","comb","combs","comfort","comforted","comforting","committing","commonly","compelling","complain","complained","compliance","comprehended","comprehension","compressed","computerized","computers"}},
{"comm", {"command","commanded","comments","commands","comment","committing","commonly"}},
{"comp", {"companion","companions","computer","company","compass","complaining","complete","compelling","complain","complained","compliance","comprehended","comprehension","compressed","computerized","computers"}},
{"compl", {"complaining","complete","complain","complained","compliance"}},
{"conc", {"conclusion","concluded","concert","concerned","concourse","concussion","concealed","conclude"}},
{"conf", {"confidence","confused","confided","confidentially","confounded","confoundedly","confusion"}},
{"cons", {"consisted","considerable","considerably","conscience","conscious","consciousness","consequential","consent","consented","conservative","consider","consisting","constructed","consult","consulting"}},
{"consi", {"consisted","considerable","considerably","consider","consisting"}},
{"cont", {"continued","contents","contract","continue","contain","control","contacting","contemplating","contended","contented","continent","continents","continual","contrary","contribute","contribution","contributions"}},
{"conti", {"continued","continue","continent","continents","continual"}},
{"contin", {"continued","continue","continent","continents","continual"}},
{"contr", {"contract","control","contrary","contribute","contribution","contributions"}},
{"cro", {"crowd","crowding","crop","crouching","croquet","crossing","crouch","crouched","crowds"}},
{"cu", {"cut","curled","curtains","cutting","cup","curiosity","curiously","curtain","custard","cue","cups","curl","curling","currently","cutoff"}},
{"cur", {"curled","curtains","curiosity","curiously","curtain","curl","curling","currently"}},
{"des", {"desire","desperate","despite","described","desert","destined","deserted","deserting","desirable","desk","desperately","destination"}},
{"di", {"did","didn","discovered","direction","directed","ditch","died","different","directly","distribute","dizzy","disappeared","dishes","disk","disturbance","dive","difficulty","dinner","disappointment","discussing","distance","dialogue","die","difference","dignity","disappearing","disappointed","disapproval","disastrous","disclaimers","disclaims","disconcerting","discovery","disgust","dishtowel","dismal","dismissal","displayed","distinguish","distinguishes","distribution","disturbed","diver","dictates","differently","difficult","diffidence","digging","dignified","dim","dimly","diogenes","dipping","dir","directing","directions","director","directors","disagree","disagreeable","disapprovingly","disarranged","disasters","disbanding","disclaimer","discomfort","disconsolate","disconsolately","discourteous","discover","disease","disentangling","dishonorable","dismount","dispatched","displays","dispose","disposed","disposing","disposition","disquieted","distant","distinguished","distributed","diving","dizzily"}},
{"direct", {"direction","directed","directly","directing","directions","director","directors"}},
{"dis", {"discovered","distribute","disappeared","dishes","disk","disturbance","disappointment","discussing","distance","disappearing","disappointed","disapproval","disastrous","disclaimers","disclaims","disconcerting","discovery","disgust","dishtowel","dismal","dismissal","displayed","distinguish","distinguishes","distribution","disturbed","disagree","disagreeable","disapprovingly","disarranged","disasters","disbanding","disclaimer","discomfort","disconsolate","disconsolately","discourteous","discover","disease","disentangling","dishonorable","dismount","dispatched","displays","dispose","disposed","disposing","disposition","disquieted","distant","distinguished","distributed"}},
{"disa", {"disappeared","disappointment","disappearing","disappointed","disapproval","disastrous","disagree","disagreeable","disapprovingly","disarranged","disasters"}},
{"disco", {"discovered","disconcerting","discovery","discomfort","disconsolate","disconsolately","discourteous","discover"}},
{"dow", {"down","downtown","downstairs","download","downpour","downward"}},
{"down", {"down","downtown","downstairs","download","downpour","downward"}},
{"ed", {"edmeston","educated","edge","education","edgar","edition","editing","editions","edging","edification","edited","edu"}},
{"exc", {"exclaimed","excitement","except","exciting","exceptionally","excited","exclamation","excellent","excess","excitable","excitedly","exclusion","exclusions"}},
{"ext", {"extended","extending","extent","exterior","extravagant"}},
{"fea", {"fear","fearing","feat","feats","feature","features","feared","fearless","fearlessly"}},
{"fear", {"fear","fearing","feared","fearless","fearlessly"}},
{"fee", {"feet","feel","feed","fee","feels","fees","feeble"}},
{"fi", {"first","find","fine","figure","field","file","finished","five","fix","finally","files","fire","fit","fifty","fingers","finish","fixed","final","finding","fish","fighting","figures","fill","fired","fight","filled","finishing","firmly","fitted","fixing","fields","fierce","fifteen","filling","film","finale","fitness","fits","fitting"}},
{"fu", {"full","further","funny","fun","fully","functionary","funding","fuming","functions","funnier","funniest","furnish","furthermore","future"}},
{"fun", {"funny","fun","functionary","funding","functions","funnier","funniest"}},
{"gri", {"grinned","grip","grin","grim","grinning","grimly","grief","grimace","grips","grit"}},
{"gro", {"ground","grounds","growled","grouch","grown","grotesque","grow","groaning","groping","grouchy","growl","growls"}},
{"grow", {"growled","grown","grow","growl","growls"}},
{"gru", {"grunted","grumbled","grudgingly","gruff","grumbling","grunt"}},
{"gu", {"guess","gutenberg","gutindex","guide","guessed","guessing","guided","guiltily","gust","gutter"}},
{"ha", {"had","have","hand","hands","half","having","has","happened","hat","hard","hanging","haven","happen","halted","happy","hart","hastily","harness","hadn","hair","hauled","handsome","hang","hay","hayrack","haze","haired","halfway","hardships","harm","habits","halt","handed","handful","handing","handle","handled","handy","happening","happily","happiness","haste","hastened","hats","hauling","habit","halting","hamlets","handily","happens","hardly","hardship","harmed","harmless","harnessed","harshly","hasn","hasp","hastening","hasty","hate","haymow","haystack"}},
{"hel", {"help","held","hello","helped","helping","helpless","helper","helplessly"}},
{"help", {"help","helped","helping","helpless","helper","helplessly"}},
{"hi", {"his","him","himself","high","hit","higher","hide","hitched","highway","hind","hire","hi","hid","hidden","hiding","hint","hitch","hitching"}},
{"hun", {"hundred","hung","hungry","hunting","hunched","hundreds","hunt","hunted"}},
{"hur", {"hurt","hurried","hurry","hurled","hurrying","hurling","hurrah","hurts"}},
{"je", {"jealous","jeered","jerk","jerked","jealousy","jerking","jest"}},
{"keep", {"keep","keeper","keeping","keepers","keeps"}},
{"kn", {"know","knew","known","knows","knowing","knee","knife","knock","knocked","knocking","knocks","knees","knickerbockers","knockout","knot","knowledge"}},
{"laug", {"laughed","laughing","laughter","laugh","laughingly"}},
{"ligh", {"light","lightly","lightning","lighting","lighted","lightening"}},
{"loc", {"located","lock","local","locked","locking","locating","locomotive"}},
{"loo", {"look","looked","looking","looks","loose","loosely","loosened"}},
{"lu", {"lucky","lump","lustily","lumps","lure","lullaby","lulled","lumbering","lunch","lunges","luxury"}},
{"me", {"me","men","mean","menagerie","meantime","meant","medium","meet","mellon","meal","meals","means","members","mental","message","met","meaning","measured","mebby","mechanic","medicine","memory","merely","merriment","merry","mettle","measure","measuring","mechanical","medical","medley","meekly","meeting","member","memories","merchandise","merchantability","mere","merged","metal","method"}},
{"mea", {"mean","meantime","meant","meal","meals","means","meaning","measured","measure","measuring"}},
{"mot", {"mother","motioned","motion","motionless","motions","motley","motto"}},
{"mou", {"mouth","mount","mouths","mounted","mounting","mourned"}},
{"mu", {"much","mule","must","mused","muttered","mud","mustn","muscled","music","muscles","muddy","multiple","multitude","murmured","musketry"}},
{"na", {"navaro","name","natural","narrow","natured","naturedly","names","naturally","named","narrowly","nature","nail","nailed","nap"}},
{"near", {"near","nearly","nearing","neared","nearer","nearest"}},
{"off", {"off","offer","office","officers","official","officer","officials"}},
{"offi", {"office","officers","official","officer","officials"}},
{"offic", {"office","officers","official","officer","officials"}},
{"ove", {"over","overspreading","overcome","overhand","overhauling","overhead","overheard","overrated","overturned"}},
{"over", {"over","overspreading","overcome","overhand","overhauling","overhead","overheard","overrated","overturned"}},
{"ow", {"own","owner","owing","owners","owns"}},
{"pac", {"packed","pace","package","paces","pacing"}},
{"perform", {"performers","performance","performer","perform","performing","performances","performs"}},
{"pon", {"pony","ponies","pondered","pondering","ponderous","pond","ponder"}},
{"pond", {"pondered","pondering","ponderous","pond","ponder"}},
{"pos", {"position","possible","possessed","possession","posted","pose","positions","posse","possibility","poster","posters","posting","postmaster"}},
{"poss", {"possible","possessed","possession","posse","possibility"}},
{"pul", {"pull","pulled","pulling","pulley","pulls","pulse"}},
{"pull", {"pull","pulled","pulling","pulley","pulls"}},
{"pun", {"punishment","punctuation","punctured","punish","punitive"}},
{"qu", {"quick","questioned","quickly","quite","question","quiet","quarter","quarters","questions","quietly","questioner","quizzically","quality","quaver","queer","queried","questionable","questioning","quilts","quizzical"}},
{"qui", {"quick","quickly","quite","quiet","quietly","quizzically","quilts","quizzical"}},
{"rece", {"received","receive","receiving","receipts","recently","recess"}},
{"rem", {"remember","remained","remain","remembered","remind","remove","remark","remarkably","remedies","reminded","remote","removing"}},
{"rep", {"replied","reply","repeated","replacement","repress","repressed","report","replace","reports","represent","representing"}},
{"res", {"rest","rescue","responded","responsible","result","reserved","resolute","results","rescued","resend","resist","resolution","resolved","resounding","resourcefulness","respecter","respective","resplendent","response","restaurants","rested","resting","restless","restlessly","resulting","resumed"}},
{"reso", {"resolute","resolution","resolved","resounding","resourcefulness"}},
{"resp", {"responded","responsible","respecter","respective","resplendent","response"}},
{"rest", {"rest","restaurants","rested","resting","restless","restlessly"}},
{"ret", {"return","returned","retorted","returning","retained","retired","retrace"}},
{"ri", {"right","rings","ring","ringmaster","ride","riding","rider","rising","ribbon","ridden","rise","risk","ribbons","rice","riddance","riders","rides","ridiculous","rifle","rig","rigged","rights","ripped","rippled","risen","river"}},
{"rid", {"ride","riding","rider","ridden","riddance","riders","rides","ridiculous"}},
{"rub", {"rubber","rubbing","rube","rub","rubbed"}},
{"scre", {"scream","screamed","screams","screaming","screen"}},
{"se", {"see","seemed","seats","set","seen","several","season","seat","send","sense","seem","settled","series","serious","seven","search","section","sending","second","secret","sensation","sent","seriously","served","securely","seeing","seems","self","setback","setting","severe","sea","seasoned","seasons","settling","searched","seclusion","seconds","secured","seeking","seldom","selected","selfsame","sensitive","sentence","sentiment","sentinels","separate","separated","serviceable","session","sets","settle","settlement","sew"}},
{"sea", {"seats","season","seat","search","sea","seasoned","seasons","searched"}},
{"sid", {"side","sides","sideshow","sidewalks","sideways"}},
{"side", {"side","sides","sideshow","sidewalks","sideways"}},
{"sig", {"sight","signal","signor","sign","significantly","sigh","significant","sighed","sighs","signature","signs"}},
{"sign", {"signal","signor","sign","significantly","significant","signature","signs"}},
{"spr", {"sprang","spring","spread","sprightly","springing","sprinkled","sprint","sprung"}},
{"spri", {"spring","sprightly","springing","sprinkled","sprint"}},
{"sq", {"squeal","squint","squarely","squealing","squinting","squirming"}},
{"squ", {"squeal","squint","squarely","squealing","squinting","squirming"}},
{"stu", {"stuck","stunt","studied","stuff","studies","stunts","stubbornness","studdings","study","stumbled","stump","stung","stupid"}},
{"su", {"such","sure","suddenly","suppose","surgeon","surprise","sudden","sugar","suit","supper","surprised","succeeded","suggested","summer","surely","sun","surprising","surveyed","subject","successful","succession","suffering","sufficient","suggestion","sunlight","support","supposed","suspended","success","sufficiently","summoned","sunny","suppers","supported","surroundings","surveying","suspiciously","sustained","subscribe","succeed","succeeding","successes","suddenness","sue","suffer","suffered","suggest","suggestions","suited","sullen","sullenly","summed","summoning","summons","sunsite","superstitious","supple","supporting","surer","surly","surreptitiously","surrounded","survey","suspect","suspected","suspecting","suspicion"}},
{"suc", {"such","succeeded","successful","succession","success","succeed","succeeding","successes"}},
{"succ", {"succeeded","successful","succession","success","succeed","succeeding","successes"}},
{"succe", {"succeeded","successful","succession","success","succeed","succeeding","successes"}},
{"suf", {"suffering","sufficient","sufficiently","suffer","suffered"}},
{"suff", {"suffering","sufficient","sufficiently","suffer","suffered"}},
{"sug", {"sugar","suggested","suggestion","suggest","suggestions"}},
{"susp", {"suspended","suspiciously","suspect","suspected","suspecting","suspicion"}},
{"sw", {"swung","swinging","swept","swing","sweep","swaying","swift","swiftly","sweet","sweets","swelled","swarmed","sway","swayed","swelling","swiftness","swimming","swum"}},
{"swi", {"swinging","swing","swift","swiftly","swiftness","swimming"}},
{"ta", {"take","taking","table","talk","taken","tail","talking","task","ta","tackle","takes","talked","taller","tatters","tax","tailor","taker","takers","talks","tall","tallow","tame","tan","tanbark","tank","tantrum","tapped","tasted","tattoo","taught","taunts","taxes"}},
{"tho", {"though","thought","those","thousand","thorpe","thoughts","thoroughly","thoughtfully","thousands"}},
{"thou", {"though","thought","thousand","thoughts","thoughtfully","thousands"}},
{"thr", {"through","threw","throwing","thrown","thrust","thrusting","three","thrilling","throw","threatening","threateningly","throat","thrill","threatened","thresh","throngs"}},
{"thre", {"threw","three","threatening","threateningly","threatened","thresh"}},
{"tru", {"trunk","trunks","trumpeting","truth","trumpeted","trumpetings","true","trumpet","trustee","trusting"}},
{"tu", {"tucker","turn","turned","turning","tune","tumble","tumbling","tugging","tucked","tug","tumbled","tumult","tunnel","turns"}},
{"tw", {"two","twenty","twisted","twinkling","twinkled","twist","twitching","twice","twilight","twined","twinkle","twists"}},
{"twi", {"twisted","twinkling","twinkled","twist","twitching","twice","twilight","twined","twinkle","twists"}},
{"unc", {"uncle","uncertain","unconscious","uncomfortable","uncertainty","unc","uncommunicative","uncurled"}},
{"und", {"under","understand","understood","understandingly","undress","underneath","understanding","undeceived","underline","undershirts","understands","understudy","undoubtedly","undressed","undulating"}},
{"unde", {"under","understand","understood","understandingly","underneath","understanding","undeceived","underline","undershirts","understands","understudy"}},
{"under", {"under","understand","understood","understandingly","underneath","understanding","underline","undershirts","understands","understudy"}},
{"underst", {"understand","understood","understandingly","understanding","understands","understudy"}},
{"ver", {"very","ver","verdict","verge","vernacular","version","versions"}},
{"vi", {"village","view","visit","violent","vi","vicious","vii","viii","visitor","vicinity","victim","viewed","viewpoint","vigorous","vigorously","villagers","violence","violently","virus","visible","visited","visitors"}},
{"vis", {"visit","visitor","visible","visited","visitors"}},
{"visi", {"visit","visitor","visible","visited","visitors"}},
{"vo", {"voice","voices","volley","volume","voiced","volunteers","vouchsafed"}},
{"wai", {"wait","waist","waiting","waite","waiter","waited","waiters"}},
{"wait", {"wait","waiting","waite","waiter","waited","waiters"}},
{"whi", {"which","while","whip","whistle","white","whirled","whispered","whistled","whirl","whirling","whistles","whistling","whit"}},
{"whis", {"whistle","whispered","whistled","whistles","whistling"}},
{"wonder", {"wonder","wondered","wonderful","wonderingly","wondering","wonderment"}},
{"woo", {"wood","woodenheads","woodhouse","woodpile","woodwork"}},
{"yo", {"you","your","young","yourself","yours","yonder","younger","youngster","youth"}},
{"you", {"you","your","young","yourself","yours","younger","youngster","youth"}}
};
SECTION ("Test correct prefix to word count") {
for (auto& x : prefix_tester)
{
auto result = tp.wordsFromPrefix(x.first);
REQUIRE (result.size() == x.second.size());
}
}
SECTION ("Prefix to word must generate the correct set of words") {
for (auto& x : prefix_tester)
{
auto result = tp.wordsFromPrefix(x.first);
for (auto word : x.second) {
auto iter = find (result.begin(), result.end(), word);
REQUIRE (iter != result.end());
}
}
}
SECTION ("Possible word from prefix must be sorted by frequency") {
for (auto& x : prefix_tester)
{
auto result = tp.wordsFromPrefix(x.first);
REQUIRE (result == x.second);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment