File: Angle.hs

package info (click to toggle)
haskell-diagrams-lib 1.4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,256 kB
  • sloc: haskell: 8,263; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- |

module Diagrams.Test.Angle where


import           Test.Tasty
import           Test.Tasty.QuickCheck
import           Diagrams.Prelude
import Instances

tests :: TestTree
tests = testGroup "Angle" [
         testProperty "2π radians per turn" $
           \θ -> θ^.rad =~ θ^.turn*2*(pi :: Double)
         , testProperty "360 degrees per turn" $
           \θ -> θ^.deg =~ θ^.turn*(360 :: Double)
         , testProperty "Angle vector addition is commutative" $
           \θ φ -> (θ :: Angle Double) ^+^ φ =~ φ ^+^ θ
         , testProperty "Angle subtraction is the inverse of addition" $
           \θ φ -> (θ :: Angle Double) ^+^ φ ^-^ φ =~ θ
         , testProperty "Angle vector negation squared is identity" $
           \θ -> negated (negated (θ :: Angle Double)) =~ θ
         , testProperty "A negated angle is the additive inverse of the original" $
           \θ -> (θ :: Angle Double) ^+^ (negated θ) =~ 0@@turn
         , testProperty "A negated angle is the additive inverse of the original" $
           \θ -> (θ :: Angle Double) ^+^ (negated θ) =~ 0@@turn


      ]