diff options
author | Yann Herklotz <git@yannherklotz.com> | 2019-10-29 12:06:05 +0000 |
---|---|---|
committer | Yann Herklotz <git@yannherklotz.com> | 2019-10-29 12:06:05 +0000 |
commit | 4ee6646b8a78d4c20fe0b89d95f23d382e1c47fc (patch) | |
tree | 9b02e1b92f8abf0baf3dc108ab7f4fb8f33e753a /test | |
parent | 1aaff80235237507572e0fb4be86f34cb1829b68 (diff) | |
parent | 01c2ab3f6a58d416528efce3057e2cf2f1604489 (diff) | |
download | verismith-feature/nondeterminism.tar.gz verismith-feature/nondeterminism.zip |
Merge branch 'master' into HEADfeature/nondeterminism
Diffstat (limited to 'test')
-rw-r--r-- | test/Benchmark.hs | 2 | ||||
-rw-r--r-- | test/Parser.hs | 16 | ||||
-rw-r--r-- | test/Property.hs | 69 | ||||
-rw-r--r-- | test/Reduce.hs | 4 | ||||
-rw-r--r-- | test/Unit.hs | 8 |
5 files changed, 27 insertions, 72 deletions
diff --git a/test/Benchmark.hs b/test/Benchmark.hs index d0ea9cd..9c81049 100644 --- a/test/Benchmark.hs +++ b/test/Benchmark.hs @@ -2,7 +2,7 @@ module Main where import Control.Lens ((&), (.~)) import Criterion.Main (bench, bgroup, defaultMain, nfAppIO) -import VeriFuzz (configProperty, defaultConfig, proceduralIO, +import Verismith (configProperty, defaultConfig, proceduralIO, propSize, propStmntDepth) main :: IO () diff --git a/test/Parser.hs b/test/Parser.hs index d300d8a..959c09b 100644 --- a/test/Parser.hs +++ b/test/Parser.hs @@ -17,18 +17,18 @@ module Parser where import Control.Lens -import Data.Either (either, isRight) -import Hedgehog (Gen, Property, (===)) -import qualified Hedgehog as Hog -import qualified Hedgehog.Gen as Hog +import Data.Either (either, isRight) +import Hedgehog (Gen, Property, (===)) +import qualified Hedgehog as Hog +import qualified Hedgehog.Gen as Hog import Test.Tasty import Test.Tasty.Hedgehog import Test.Tasty.HUnit import Text.Parsec -import VeriFuzz -import VeriFuzz.Internal -import VeriFuzz.Verilog.Lex -import VeriFuzz.Verilog.Parser +import Verismith +import Verismith.Internal +import Verismith.Verilog.Lex +import Verismith.Verilog.Parser smallConfig :: Config smallConfig = defaultConfig & configProperty . propSize .~ 5 diff --git a/test/Property.hs b/test/Property.hs index 4e17695..7e1911e 100644 --- a/test/Property.hs +++ b/test/Property.hs @@ -11,30 +11,21 @@ module Property ) where -import Data.Either ( either - , isRight - ) -import qualified Data.Graph.Inductive as G -import Data.Text ( Text ) -import Hedgehog ( Gen - , Property - , (===) - ) -import qualified Hedgehog as Hog -import Hedgehog.Function ( Arg - , Vary - ) -import qualified Hedgehog.Function as Hog -import qualified Hedgehog.Gen as Hog -import qualified Hedgehog.Range as Hog -import Parser ( parserTests ) +import Data.Either (either, isRight) +import qualified Data.Graph.Inductive as G +import Data.Text (Text) +import Hedgehog (Gen, Property, (===)) +import qualified Hedgehog as Hog +import qualified Hedgehog.Gen as Hog +import qualified Hedgehog.Range as Hog +import Parser (parserTests) import Test.Tasty import Test.Tasty.Hedgehog import Text.Parsec -import VeriFuzz -import VeriFuzz.Result -import VeriFuzz.Verilog.Lex -import VeriFuzz.Verilog.Parser +import Verismith +import Verismith.Result +import Verismith.Verilog.Lex +import Verismith.Verilog.Parser randomDAG' :: Gen Circuit randomDAG' = Hog.resize 30 randomDAG @@ -52,45 +43,9 @@ acyclicGraph = Hog.property $ do . getCircuit $ g -type GenFunctor f a b c = - ( Functor f - , Show (f a) - , Show a, Arg a, Vary a - , Show b, Arg b, Vary b - , Show c - , Eq (f c) - , Show (f c) - ) - -mapCompose - :: forall f a b c - . GenFunctor f a b c - => (forall x . Gen x -> Gen (f x)) - -> Gen a - -> Gen b - -> Gen c - -> Property -mapCompose genF genA genB genC = Hog.property $ do - g <- Hog.forAllFn $ Hog.fn @a genB - f <- Hog.forAllFn $ Hog.fn @b genC - xs <- Hog.forAll $ genF genA - fmap (f . g) xs === fmap f (fmap g xs) - -propertyResultInterrupted :: Property -propertyResultInterrupted = do - mapCompose genResult - (Hog.int (Hog.linear 0 100)) - (Hog.int (Hog.linear 0 100)) - (Hog.int (Hog.linear 0 100)) - where - genResult :: Gen a -> Gen (Result Text a) - genResult a = Hog.choice - [Pass <$> a, Fail <$> Hog.text (Hog.linear 1 100) Hog.unicode] - propertyTests :: TestTree propertyTests = testGroup "Property Tests" [ testProperty "acyclic graph generation check" acyclicGraph - , testProperty "fmap for Result" propertyResultInterrupted , parserTests ] diff --git a/test/Reduce.hs b/test/Reduce.hs index 722ddea..fcc10aa 100644 --- a/test/Reduce.hs +++ b/test/Reduce.hs @@ -20,8 +20,8 @@ where import Data.List ((\\)) import Test.Tasty import Test.Tasty.HUnit -import VeriFuzz -import VeriFuzz.Reduce +import Verismith +import Verismith.Reduce reduceUnitTests :: TestTree reduceUnitTests = testGroup diff --git a/test/Unit.hs b/test/Unit.hs index aaffe09..f761c68 100644 --- a/test/Unit.hs +++ b/test/Unit.hs @@ -4,12 +4,12 @@ module Unit where import Control.Lens -import Data.List.NonEmpty ( NonEmpty(..) ) -import Parser ( parseUnitTests ) -import Reduce ( reduceUnitTests ) +import Data.List.NonEmpty (NonEmpty (..)) +import Parser (parseUnitTests) +import Reduce (reduceUnitTests) import Test.Tasty import Test.Tasty.HUnit -import VeriFuzz +import Verismith unitTests :: TestTree unitTests = testGroup |