1 | -- expects two snippet IDs (solution, test case) as input |
2 | -- example: "#121 #122" |
3 | |
4 | if input == nil then error("Needs input.") end
|
5 | |
6 | solutionID, testCaseID = input:match("([^ ]+) +([^ ]+)")
|
7 | if not solutionID then |
8 | error("Could not parse input, expected two snippet IDs")
|
9 | end |
10 | |
11 | solutionF = loadSnippet(solutionID) |
12 | assert(solutionF, 'Solution does not parse: '..solutionID) |
13 | |
14 | pcall(solutionF) |
15 | if solution == nil then solution = function(_input) |
16 | input = _input -- yeah the whole env thing is hacky right here |
17 | return solutionF() |
18 | end end |
19 | |
20 | verifierF = loadSnippet(testCaseID) |
21 | assert(verifierF, 'Test case does not parse: '..testCaseID) |
22 | if verifierF() then |
23 | print "Verified!" |
24 | solution = nil -- to not apply RunCmd/DebugCmd's "find solution function" magic... |
25 | return true |
26 | else |
27 | error("Not verified.")
|
28 | end |
test run test run with input download show line numbers
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
2 comment(s) hidden. show
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 833 | [visualize] |
| Snippet ID: | #123 |
| Snippet name: | Pitcher core |
| Eternal ID of this version: | #123/1 |
| Text MD5: | 39f2e40d59c77373172a22a1afc52849 |
| Author: | stefan |
| Category: | |
| Type: | Lua code |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2014-01-10 19:41:01 |
| Source code size: | 833 bytes / 28 lines |
| Pitched / IR pitched: | Yes / Yes |
| Views / Downloads: | 2245 / 5031 |
| Referenced in: | [show references] |