I'm gonna make these tests states soon

This commit is contained in:
Rowan Torbitzky-Lane 2025-01-27 12:17:40 -06:00
parent 7c9cdb8ed8
commit c9923eae02

View File

@ -5,6 +5,7 @@ import Instructions.FloatInstructions
import Instructions.IntInstructions
import Instructions.StringInstructions
import Instructions.CharInstructions
import Instructions.VectorIntInstructions
import Push
import State
@ -44,6 +45,11 @@ charTestFunc name goal genome startState =
let state = loadProgram genome startState
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 = do
-- Int tests
@ -245,3 +251,6 @@ main = do
boolTestFunc "instructionCharIsLetterFalse" [False] [GeneChar '1', StateFunc instructionCharIsLetter] emptyState
boolTestFunc "instructionCharIsDigitTrue" [True] [GeneChar '1', 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