We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6b1aaf9 commit 4659e9fCopy full SHA for 4659e9f
test/Geometry/Plane/Test.hs
@@ -3,7 +3,27 @@ module Geometry.Plane.Test
3
( tests
4
) where
5
6
-import Hedgehog
+import Geometry.Plane
7
+import Hedgehog
8
+import qualified Hedgehog.Gen as Gen
9
+import qualified Hedgehog.Range as Range
10
+import Linear.V2
11
+
12
+prop_signedDistance_identity = property $ do
13
+ v <- forAll $ v2 coord
14
+ n <- forAll (v2 (nonZero coord))
15
+ signedDistance v n v === 0
16
17
18
+coord :: MonadGen m => m Rational
19
+coord = Gen.realFrac_ (Range.linearFrac (-100) 100)
20
21
+nonZero :: (MonadGen m, Num a, Eq a) => m a -> m a
22
+nonZero = Gen.filterT (/= 0)
23
24
+v2 :: MonadGen m => m a -> m (V2 a)
25
+v2 g = V2 <$> g <*> g
26
27
28
tests :: IO Bool
29
tests = checkParallel $$(discover)
0 commit comments