packages feed

geomancy-0.4.1.0 / test / Spec / Point.hs

{-# LANGUAGE BlockArguments #-}{-# LANGUAGE ImportQualifiedPost #-}{-# LANGUAGE OverloadedStrings #-}module Spec.Point (tests) whereimport Geomancyimport Hedgehogimport Test.Tasty (TestTree, testGroup)import Test.Tasty.Hedgehog (testPropertyNamed)import Geomancy.Point qualifiedtests :: TestTreetests = testGroup "Point"  [ testPropertyNamed "dpoint" "prop_dpoint" prop_dpoint  ]prop_dpoint :: Propertyprop_dpoint = withTests 1 $ property do  let    far = 1e9    a = Point (dvec3 far 0 0) :: DPoint3    b = Point (dvec3 (far + 0.5) 0 0)  0.5 === Geomancy.Point.distance a b  b === a .+^ dvec3 0.5 0 0  dvec3 0.5 0 0 === b .-. a  Point (dvec3 (far + 0.25) 0 0) === Geomancy.Point.lerp a b 0.5  5 === Geomancy.Point.distance (Point (vec3 0 0 0)) (Point (vec3 3 4 0))