aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorYann Herklotz <git@yannherklotz.com>2020-04-26 16:57:22 +0100
committerYann Herklotz <git@yannherklotz.com>2020-04-26 16:57:22 +0100
commit34aaba05bda3377a90e056b7b371cae82778a202 (patch)
tree6132e2294f61c9b9308152f3baa4e24eb7662a4c /test
parent0fb9d8a7097c45a7f522c428850bf88d738d576b (diff)
downloadverismith-34aaba05bda3377a90e056b7b371cae82778a202.tar.gz
verismith-34aaba05bda3377a90e056b7b371cae82778a202.zip
Add distance to commandline
Diffstat (limited to 'test')
-rw-r--r--test/Distance.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/Distance.hs b/test/Distance.hs
index 430d215..a59b401 100644
--- a/test/Distance.hs
+++ b/test/Distance.hs
@@ -3,7 +3,7 @@ module Distance
)
where
-import Hedgehog (Property)
+import Hedgehog (Property, (===))
import qualified Hedgehog as Hog
import qualified Hedgehog.Gen as Hog
import qualified Hedgehog.Range as Hog
@@ -13,9 +13,18 @@ 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)
+ x <- Hog.forAll (Hog.list (Hog.linear 0 15) Hog.alpha)
+ y <- Hog.forAll (Hog.list (Hog.linear 0 15) Hog.alpha)
Hog.assert $ udistance x y <= distance x y
+distanceEq :: Property
+distanceEq = Hog.property $ do
+ x <- Hog.forAll (Hog.list (Hog.linear 0 15) Hog.alpha)
+ distance x x === 0
+ udistance x x === 0
+
distanceTests :: TestTree
-distanceTests = testProperty "Unordered distance <= distance" distanceLess
+distanceTests = testGroup "Distance tests"
+ [ testProperty "Unordered distance <= distance" distanceLess
+ , testProperty "distance x x === 0" distanceEq
+ ]