(* Auto-tester for fast_trib function. *) use "tester.sml"; (* common utility functions *) (* Avoid "unbound variable or constructor" errors. *) type bigint = LargeInt.int; fun fast_trib _ _ = raise Undefined; (* Load file. *) print "\n--> Loading file \"bonus.sml\"\n"; use "../bonus.sml" handle _ => (); (* Run test cases. *) ( print "\n--> Beginning test cases for function 'fast_trib'...\n"; runtests total grade (fast_trib (3,5,~7)) "fast_trib (3,5,~7)" bigint2string bigint2string (op =) [ (0, 5, "(* base case *)", 0.2), (1, ~7, "(* base case *)", 0.2), (2, 1, "(* small recursive case *)", 0.1), (3, ~1, "(* small recursive case *)", 0.1), (57, ~479473773418063, "(* medium recursive case *)", 0.2), (200, ~33545577673585061001850584823413365785961484479119219, "(* large recursive case *)", 0.2), (~1, 3, "(* base case *)", 0.2), (~2, ~15, "(* small recursive case *)", 0.1), (~3, 17, "(* small recursive case *)", 0.1), (~150, 230976437018603109393, "(* large recursive case *)", 0.2), (~500, 12053640228014115313140674383675917589523419976015381365183297402801, "(* larger recursive case *)", 0.2) ]; print ("\n--> Grade = " ^ real2string (!grade) ^ " / " ^ real2string (!total) ^ "\n\n"); runtests total grade (fast_trib (3,5,~7)) "fast_trib (3,5,~7)" bigint2string bigint2string (op =) [ (10000, ~1230782806543758750740068650687427530571373852433766424600965791570546605871494177975109135430901108939894643961292769047412533649908613663511938517378118158066376831301375602995128341477116498203625526623479568268629699103887643083973349184983427544005964321136322734653821140722952577068185205499962820790812216305009931489989134054194563714090366376514646870239322442041092600503969762894865740311409865267332734437383788795848942801602364801268826233161500326520211026872121803437187892995158607762981798555770706775255974109528913560122326723455977056356211198278467527584193762813947015285095259002430534875521064107756203082635555486491818764208833215079798200710090918764461262967969154697341174430155449902552061283162150164600765598193286256340531883198502186927390295256861804856704101665233554772745878853489254352700359204902972367056204718424574879148669320148636504232624301806945324090895610130710410817482274438623157157741559125245017591547122917285314583920434179196429441147305486628078307536539459836248640736019506764474925408256233311530057414271838236369469020497826363153433046108281956101398121420443869951556930860121050461722465195726574523539774248592504123049094397415610904981758674919933974180106689961275226900038670080288802169413168322226073199421000310960219080221009420905360437933619536670726781014709309399016984188565324009323012941621325259490992550263772946534349427895394278033768348423217078245733496056128288493620195490167916316267090914735129625986811115004890349774979762432251410297189575570977356290967524134698446399993024280861073622169301790297821617754489813798037757548762528767739370703860584633986164081277075498066847444125319292327257303026757772999149428496550726778035365514692070223967012916372206084081708709528471051825306202170691667413982162024569260353861683620660348408037576307096246841249148158161517214331493219918011496137471875188451995197555387842063144145848109542972258223418740512729505212455279015419351654502110774735209817560099299975910388130511118310469384597726913942543344720818374133180450759904209882121088451564469668072921609733441010779868099998690137322899485142592421046899898508169902193439564248975271351707403384923475287658474895927603906693353976778481398757793760446160363398246098383846970639281565103943700491121622295353496410511835461656629394333502834427660315099808180753363789069661925378919246064779004702452585323737430635298875960864215602260392737490036725396418137128564414620174878262443248367327392987755008885671596515475043286639604550738151649581486216427967276782876216571835189604125346233977608391010139603100649549062824950750059, "(* huge recursive case *)", 0.2) ] ); (* Print total grade. *) print ("\n--> Grade = " ^ real2string (!grade) ^ " / " ^ real2string (!total) ^ "\n\n"); (* Quit the SML interpreter. *) exit 0;