I'm gonna make these tests states soon
This commit is contained in:
parent
7c9cdb8ed8
commit
c9923eae02
@ -5,6 +5,7 @@ import Instructions.FloatInstructions
|
|||||||
import Instructions.IntInstructions
|
import Instructions.IntInstructions
|
||||||
import Instructions.StringInstructions
|
import Instructions.StringInstructions
|
||||||
import Instructions.CharInstructions
|
import Instructions.CharInstructions
|
||||||
|
import Instructions.VectorIntInstructions
|
||||||
import Push
|
import Push
|
||||||
import State
|
import State
|
||||||
|
|
||||||
@ -44,6 +45,11 @@ charTestFunc name goal genome startState =
|
|||||||
let state = loadProgram genome startState
|
let state = loadProgram genome startState
|
||||||
in assert (goal == _char (interpretExec state)) putStrLn (name <> " passed test.")
|
in assert (goal == _char (interpretExec state)) putStrLn (name <> " passed test.")
|
||||||
|
|
||||||
|
intVectorTestFunc :: String -> [[Int]] -> [Gene] -> State -> IO ()
|
||||||
|
intVectorTestFunc name goal genome startState =
|
||||||
|
let state = loadProgram genome startState
|
||||||
|
in assert (goal == _intVector (interpretExec state)) putStrLn (name <> " passed test.")
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = do
|
main = do
|
||||||
-- Int tests
|
-- Int tests
|
||||||
@ -245,3 +251,6 @@ main = do
|
|||||||
boolTestFunc "instructionCharIsLetterFalse" [False] [GeneChar '1', StateFunc instructionCharIsLetter] emptyState
|
boolTestFunc "instructionCharIsLetterFalse" [False] [GeneChar '1', StateFunc instructionCharIsLetter] emptyState
|
||||||
boolTestFunc "instructionCharIsDigitTrue" [True] [GeneChar '1', StateFunc instructionCharIsDigit] emptyState
|
boolTestFunc "instructionCharIsDigitTrue" [True] [GeneChar '1', StateFunc instructionCharIsDigit] emptyState
|
||||||
boolTestFunc "instructionCharIsDigitFalse" [False] [GeneChar 'a', StateFunc instructionCharIsDigit] emptyState
|
boolTestFunc "instructionCharIsDigitFalse" [False] [GeneChar 'a', StateFunc instructionCharIsDigit] emptyState
|
||||||
|
|
||||||
|
-- vector int instructions
|
||||||
|
intVectorTestFunc "instructionIntVectorConcat" [[4,5,6,1,2,3]] [GeneIntVector [1,2,3], GeneIntVector [4,5,6], StateFunc instructionIntVectorConcat] emptyState
|
||||||
|
Loading…
x
Reference in New Issue
Block a user