start of testing!
This commit is contained in:
parent
b37359a4f3
commit
22279a641a
@ -3,11 +3,26 @@ module HushGP.PushTests.IntTests where
|
|||||||
import HushGP.State
|
import HushGP.State
|
||||||
import HushGP.Instructions.IntInstructions
|
import HushGP.Instructions.IntInstructions
|
||||||
-- import HushGP.PushTests.GenericTests
|
-- import HushGP.PushTests.GenericTests
|
||||||
-- -- import Control.Lens hiding (uncons)
|
import Control.Lens hiding (uncons)
|
||||||
import Test.Tasty
|
import Test.Tasty
|
||||||
|
import Test.Tasty.QuickCheck as QC
|
||||||
|
|
||||||
-- prop_IntAdd :: State -> Property
|
main :: IO ()
|
||||||
-- prop_IntAdd = aaa1Test int instructionIntAdd (+)
|
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 :: State -> Property
|
||||||
-- prop_IntSub = aaa1Test int instructionIntSub (-)
|
-- prop_IntSub = aaa1Test int instructionIntSub (-)
|
||||||
|
@ -5,7 +5,7 @@ module HushGP.State where
|
|||||||
import Control.Lens hiding (elements)
|
import Control.Lens hiding (elements)
|
||||||
import Data.Map qualified as Map
|
import Data.Map qualified as Map
|
||||||
import System.Random
|
import System.Random
|
||||||
import Test.QuickCheck
|
import Test.Tasty.QuickCheck
|
||||||
import GHC.Generics
|
import GHC.Generics
|
||||||
|
|
||||||
-- | The exec stack must store heterogenous types,
|
-- | The exec stack must store heterogenous types,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user