start of testing!

This commit is contained in:
Rowan Torbitzky-Lane 2025-03-07 16:11:15 -06:00
parent b37359a4f3
commit 22279a641a
2 changed files with 19 additions and 4 deletions

View File

@ -3,11 +3,26 @@ module HushGP.PushTests.IntTests where
import HushGP.State
import HushGP.Instructions.IntInstructions
-- import HushGP.PushTests.GenericTests
-- -- import Control.Lens hiding (uncons)
import Control.Lens hiding (uncons)
import Test.Tasty
import Test.Tasty.QuickCheck as QC
-- prop_IntAdd :: State -> Property
-- prop_IntAdd = aaa1Test int instructionIntAdd (+)
main :: IO ()
main = defaultMain intTests
-- |Holds the tree for property and unit tests.
intTests :: TestTree
intTests = testGroup "All Int Tests" [propIntTests]
-- |Property int tests.
propIntTests :: TestTree
propIntTests = testGroup "Property Int Tests"
[
QC.testProperty "Property Int Add test" prop_IntAdd
]
prop_IntAdd :: State -> Property
prop_IntAdd state@(State {_int = is}) = if length is < 2 then length (view int (instructionIntAdd state)) === length (view int state) else length (view int (instructionIntAdd state)) === length (view int state) - 1
-- prop_IntSub :: State -> Property
-- prop_IntSub = aaa1Test int instructionIntSub (-)

View File

@ -5,7 +5,7 @@ module HushGP.State where
import Control.Lens hiding (elements)
import Data.Map qualified as Map
import System.Random
import Test.QuickCheck
import Test.Tasty.QuickCheck
import GHC.Generics
-- | The exec stack must store heterogenous types,