/** Ċ Ġ* ĠCopyright Ġ( C ) Ġ 2 0 1 8 ĠDr . ĠDavid ĠH . ĠA keh ur st Ġ( http :// dr . david . h . ake hur st . net ) Ċ Ġ* Ċ Ġ* ĠLicensed Ġunder Ġthe ĠApache ĠLicense , ĠVersion Ġ 2 . 0 Ġ( the Ġ" License "); Ċ Ġ* Ġyou Ġmay Ġnot Ġuse Ġthis Ġfile Ġexcept Ġin Ġcompliance Ġwith Ġthe ĠLicense . Ċ Ġ* ĠYou Ġmay Ġobtain Ġa Ġcopy Ġof Ġthe ĠLicense Ġat Ċ Ġ* Ċ Ġ* ĠĠĠĠĠĠĠĠ Ġhttp :// www . apache . org / licenses / LICENSE - 2 . 0 Ċ Ġ* Ċ Ġ* ĠUnless Ġrequired Ġby Ġapplicable Ġlaw Ġor Ġagreed Ġto Ġin Ġwriting , Ġsoftware Ċ Ġ* Ġdistributed Ġunder Ġthe ĠLicense Ġis Ġdistributed Ġon Ġan Ġ" AS ĠIS " ĠBASIS , Ċ Ġ* ĠWITHOUT ĠWARRANTIES ĠOR ĠCONDITIONS ĠOF ĠANY ĠKIND , Ġeither Ġexpress Ġor Ġimplied . Ċ Ġ* ĠSee Ġthe ĠLicense Ġfor Ġthe Ġspecific Ġlanguage Ġgoverning Ġpermissions Ġand Ċ Ġ* Ġlimitations Ġunder Ġthe ĠLicense . Ċ Ġ*/ Ċ Ċ package Ġnet . ake hur st . language . parser . scan on demand Ċ Ċ import Ġnet . ake hur st . language . ag l . parser . Scan On Demand Parser Ċ import Ġnet . ake hur st . language . ag l . runtime . structure . Runtime Rule Set Ċ import Ġnet . ake hur st . language . ag l . runtime . structure . Runtime Rule Set Builder Ċ import Ġnet . ake hur st . language . ag l . sp pt . SP PT Parser Default Ċ import Ġnet . ake hur st . language . api . processor . Automaton Kind Ċ import Ġnet . ake hur st . language . api . sp pt . Shared Packed ParseTree Ċ import Ġtest . assertEquals Warning Ċ import Ġkotlin . test . assertEquals Ċ Ċ internal Ġabstract Ġclass Ġtest _ Scan On Demand Parser Abstract Ġ{ ĊĊĠĠĠ Ġfun Ġtest ( rr s : Runtime Rule Set , Ġgoal : String , Ġsentence : String , Ġexpected Num G SS Head s : Int , Ġvar arg Ġexpected Trees : String ) Ġ: ĠShared Packed ParseTree Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġparser Ġ= ĠScan On Demand Parser ( rr s ) ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= Ġparser . parse For Goal ( goal , Ġsentence , ĠAutom aton Kind . LOOK A HEAD _ 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsp pt Ġ= ĠSP PT Parser Default ( rr s ) ĊĠĠĠĠĠĠĠ Ġexpected Trees . forEach Ġ{ Ġsp pt . add Tree ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġsp pt . tree ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected . toString All With Indent (" Ġ Ġ"), Ġactual . toString All With Indent (" Ġ Ġ")) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġactual ) ĊĠĠĠĠĠĠĠ Ġ// FIX ME : Ġadd Ġback Ġthis Ġassert ĊĠĠĠĠĠĠĠ ĠassertEquals Warning ( expected Num G SS Head s , Ġactual . max Num Head s ," Too Ġmany Ġheads Ġon ĠG SS ") ĊĠĠĠĠĠĠĠ Ġreturn Ġactual ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġtest ( rr sb : Runtime Rule Set Builder , Ġgoal : String , Ġsentence : String , Ġvar arg Ġexpected Trees : String ) Ġ: ĠShared Packed ParseTree Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġparser Ġ= ĠScan On Demand Parser ( rr sb . rule Set ()) ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= Ġparser . parse For Goal ( goal , Ġsentence , ĠAutom aton Kind . LOOK A HEAD _ 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsp pt Ġ= ĠSP PT Parser Default ( rr sb . rule Set ()) ĊĠĠĠĠĠĠĠ Ġexpected Trees . forEach Ġ{ Ġsp pt . add Tree ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġsp pt . tree ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġactual ) ĊĠĠĠĠĠĠĠ Ġreturn Ġactual ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġfun Ġtest String Result ( rr sb : Runtime Rule Set Builder , Ġgoal : String , Ġsentence : String , Ġvar arg Ġexpected Trees : String ) Ġ: ĠShared Packed ParseTree Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġparser Ġ= ĠScan On Demand Parser ( rr sb . rule Set ()) ĊĠĠĠĠĠĠĠ Ġval Ġactual Ġ= Ġparser . parse For Goal ( goal , Ġsentence , ĠAutom aton Kind . LOOK A HEAD _ 1 ) ĊĊĠĠĠĠĠĠĠ Ġval Ġsp pt Ġ= ĠSP PT Parser Default ( rr sb . rule Set ()) ĊĠĠĠĠĠĠĠ Ġexpected Trees . forEach Ġ{ Ġsp pt . add Tree ( it ) Ġ} ĊĠĠĠĠĠĠĠ Ġval Ġexpected Ġ= Ġsp pt . tree ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected . toString All With Indent (" Ġ Ġ"), Ġactual . toString All With Indent (" Ġ Ġ")) ĊĠĠĠĠĠĠĠ ĠassertEquals ( expected , Ġactual ) ĊĠĠĠĠĠĠĠ Ġreturn Ġactual ĊĠĠĠ Ġ} Ċ }