a fully working interpreter?
This commit is contained in:
parent
e865ba7407
commit
226ed32df6
11
src/Tests.hs
11
src/Tests.hs
@ -4,7 +4,7 @@ import Push
|
|||||||
|
|
||||||
exampleState =
|
exampleState =
|
||||||
State
|
State
|
||||||
{ exec = [IntGene 5, FloatGene 3.4, BoolGene True, StringGene "hi"],
|
{ exec = [IntGene 5, StateFunc instructionParameterLoad, StateFunc instructionIntAdd],
|
||||||
int = [1, 2, 3],
|
int = [1, 2, 3],
|
||||||
float = [1.2, 1.7],
|
float = [1.2, 1.7],
|
||||||
bool = [True, False],
|
bool = [True, False],
|
||||||
@ -15,7 +15,12 @@ exampleState =
|
|||||||
-- intAdd
|
-- intAdd
|
||||||
testResult1 = [3, 3] == int (instructionIntAdd exampleState)
|
testResult1 = [3, 3] == int (instructionIntAdd exampleState)
|
||||||
|
|
||||||
loaded = loadProgarm [IntGene 6, IntGene 6, StateFunc instructionParameterLoad, StateFunc instructionIntAdd] exampleState
|
-- interpretExec
|
||||||
|
testResult2 = [6,1,2,3] == int (interpretExec exampleState)
|
||||||
|
|
||||||
|
-- This nukes the exec stack, just as an example of how to load at the start.
|
||||||
|
loadedState = loadProgarm [IntGene 6, IntGene 6, StateFunc instructionParameterLoad, StateFunc instructionIntAdd] emptyState
|
||||||
|
|
||||||
-- interpretExec
|
-- interpretExec
|
||||||
testResult2 = [7,6,1,2,3] == int (interpretExec loaded)
|
testResult3 = [12] == int (interpretExec loadedState)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user