diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Distance.hs | 21 | ||||
-rw-r--r-- | test/Property.hs | 2 |
2 files changed, 23 insertions, 0 deletions
diff --git a/test/Distance.hs b/test/Distance.hs new file mode 100644 index 0000000..430d215 --- /dev/null +++ b/test/Distance.hs @@ -0,0 +1,21 @@ +module Distance + ( distanceTests + ) +where + +import Hedgehog (Property) +import qualified Hedgehog as Hog +import qualified Hedgehog.Gen as Hog +import qualified Hedgehog.Range as Hog +import Verismith.Verilog.Distance +import Test.Tasty +import Test.Tasty.Hedgehog + +distanceLess :: Property +distanceLess = Hog.property $ do + x <- Hog.forAll (Hog.list (Hog.linear 0 10) Hog.alpha) + y <- Hog.forAll (Hog.list (Hog.linear 0 10) Hog.alpha) + Hog.assert $ udistance x y <= distance x y + +distanceTests :: TestTree +distanceTests = testProperty "Unordered distance <= distance" distanceLess diff --git a/test/Property.hs b/test/Property.hs index 7e1911e..64f9bc6 100644 --- a/test/Property.hs +++ b/test/Property.hs @@ -26,6 +26,7 @@ import Verismith import Verismith.Result import Verismith.Verilog.Lex import Verismith.Verilog.Parser +import Distance (distanceTests) randomDAG' :: Gen Circuit randomDAG' = Hog.resize 30 randomDAG @@ -48,4 +49,5 @@ propertyTests = testGroup "Property Tests" [ testProperty "acyclic graph generation check" acyclicGraph , parserTests + , distanceTests ] |