packages feed

geom2d-0.1.0.1: Test/Distance.hs

{-# LANGUAGE TemplateHaskell #-}

import Data.AEq
import Geom2d.Point
import Geom2d.Distance
import Test.QuickCheck
import Test.Utils

prop_distance_point_point :: Point' Float -> Point' Float -> Bool
prop_distance_point_point p q =
  distance p q ~==
  sqrt ( (x p - x q)^(2::Int) + (y p - y q)^(2::Int) )

return []
runTests = $quickCheckAll

main :: IO ()
main = do
  putStrLn "Test Distance"
  runTests >>= doExit