aboutsummaryrefslogtreecommitdiffstats
path: root/test/Distance.hs
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-04-26 03:25:29 +0100
committerYann Herklotz <git@yannherklotz.com>2020-04-26 03:25:29 +0100
commita3fdc99c2066ace9855a6b687274a30bebb274bc (patch)
treee6341f67bbf59fc928873a03df3294f74a9bbdab /test/Distance.hs
parentdf4d642fde676cd3602ca53ba788c0f1d188fe5d (diff)
downloadverismith-a3fdc99c2066ace9855a6b687274a30bebb274bc.tar.gz
verismith-a3fdc99c2066ace9855a6b687274a30bebb274bc.zip
Add distance measure for lists with testcases
Diffstat (limited to 'test/Distance.hs')
-rw-r--r--test/Distance.hs21
1 files changed, 21 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