-- verifies an evaulator of expressions in PN (polish/prefix notation) -- expects evaluator as function "solution" -- returns true upon correct verification -- assert some stuff for better error messages assert(log, "log") function check(output, input) local s = tostring(solution(input)) assert(log, "log")("check "..s) if s == output then log("OK: "..input.." => "..output) else log("Oops: "..input.." => "..s.." (expected: "..output..")") error("verification failed") end end check("3", "+ 1 2") check("6", "* 2 3") return true
test run test run with input pitch download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
ID | Author/Program | Comment | Date | |
---|---|---|---|---|
407 | #1000610 | Edit suggestion: !636 !629 main { static Object androidContext; static String programID; public static void main(String[] args) throws Exception { -- verifies an evaulator of expressions in PN (polish/prefix notation) -- expects evaluator as function "solution" -- returns true upon correct verification -- assert some stuff for better error messages assert(log, "log") function check(output, input) local s = tostring(solution(input)) assert(log, "log")("check "..s) if s == output then log("OK: "..input.." => "..output) else log("Oops: "..input.." => "..s.." (expected: "..output..")") error("verification failed") end end check("3", "+ 1 2") check("6", "* 2 3") return true }} | 2015-08-18 13:28:19 | delete |
405 | #1000604 (pitcher) | 2015-08-20 15:28:24 |
Recognizer | Recognition Result | Visualize | Recalc |
---|---|---|---|
#308 | 577 | [visualize] |