Compare commits

..

No commits in common. "b37359a4f36a2a857bb2c65e3c3ee6c3a598e98d" and "b0c3a7626e129f8a9ccccfdf6b8d4e0acfbe6e87" have entirely different histories.

3 changed files with 6 additions and 53 deletions

View File

@ -81,7 +81,7 @@ library
-- Other library packages from which modules are imported.
build-depends:
base, containers, lens, split, regex-tdfa, template-haskell, random, parallel, random-shuffle, dsp, hmatrix, tasty, tasty-hunit, tasty-quickcheck
base, containers, lens, split, QuickCheck, regex-tdfa, template-haskell, random, parallel, random-shuffle, dsp, hmatrix, tasty
-- Directories containing source files.
hs-source-dirs: src

View File

@ -1,10 +1,10 @@
module HushGP.PushTests.IntTests where
import HushGP.State
import HushGP.Instructions.IntInstructions
-- import HushGP.State
-- import HushGP.Instructions.IntInstructions
-- import HushGP.PushTests.GenericTests
-- -- import Control.Lens hiding (uncons)
import Test.Tasty
-- import Test.QuickCheck
-- prop_IntAdd :: State -> Property
-- prop_IntAdd = aaa1Test int instructionIntAdd (+)

View File

@ -1,12 +1,10 @@
{-# LANGUAGE TemplateHaskell, DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
module HushGP.State where
import Control.Lens hiding (elements)
import Data.Map qualified as Map
import System.Random
import Test.QuickCheck
import GHC.Generics
-- | The exec stack must store heterogenous types,
-- and we must be able to detect that type at runtime.
@ -44,7 +42,6 @@ data Gene
CrossoverPadding
| -- | This is used in best match crossover (bmx in PushArgs).
Gap
deriving Generic
instance Eq Gene where
GeneInt x == GeneInt y = x == y
@ -158,29 +155,6 @@ instance Show Gene where
show CrossoverPadding = "Crossover Padding"
show Gap = "Gap"
instance CoArbitrary StdGen where
coarbitrary _ gen = gen
instance CoArbitrary Gene
instance Arbitrary Gene where
arbitrary =
oneof
[ GeneInt <$> arbitrary,
GeneFloat <$> arbitrary,
GeneBool <$> arbitrary,
GeneString <$> arbitrary,
GeneChar <$> arbitrary,
StateFunc <$> arbitrary,
-- PlaceInput <$> arbitrary,
GeneVectorInt <$> arbitrary,
GeneVectorFloat <$> arbitrary,
GeneVectorBool <$> arbitrary,
GeneVectorString <$> arbitrary,
GeneVectorChar <$> arbitrary,
Block <$> arbitrary
]
-- | The structure that holds all of the values.
data State = State
{ _exec :: [Gene],
@ -198,28 +172,7 @@ data State = State
_parameter :: [Gene],
_input :: Map.Map Int Gene
}
deriving (Show, Eq, Ord, Generic)
instance CoArbitrary State
instance Arbitrary State where
arbitrary = do
arbExec <- arbitrary
arbCode <- arbitrary
arbInt <- arbitrary
arbFloat <- arbitrary
arbBool <- arbitrary
arbString <- arbitrary
arbChar <- arbitrary
arbVectorInt <- arbitrary
arbVectorFloat <- arbitrary
arbVectorBool <- arbitrary
arbVectorString <- arbitrary
arbVectorChar <- arbitrary
arbParameter <- arbitrary
-- arbInput <- arbitrary
State arbExec arbCode arbInt arbFloat arbBool arbString arbChar arbVectorInt arbVectorFloat arbVectorBool arbVectorString arbVectorChar arbParameter <$> arbitrary
-- Thanks hlint lol
deriving (Show, Eq, Ord)
emptyState :: State
emptyState =