Skip to content

Commit a9ba399

Browse files
authored
Merge pull request #121 from purescript/ord-util-tests
Add tests for Ord util functions
2 parents cf21328 + c0aeb0b commit a9ba399

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/Test/Main.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ main :: AlmostEff
88
main = do
99
testNumberShow show
1010
testOrderings
11+
testOrdUtils
1112
testIntDegree
1213

1314
foreign import testNumberShow :: (Number -> String) -> AlmostEff
@@ -72,6 +73,15 @@ testOrderings = do
7273
testOrd [1, 1] [1, 0] GT
7374
testOrd [1, -1] [1, 0] LT
7475

76+
testOrdUtils :: AlmostEff
77+
testOrdUtils = do
78+
assert "-5 clamped between 0 and 10 should be 0" $ clamp 0 10 (-5) == 0
79+
assert "5 clamped between 0 and 10 should be 5" $ clamp 0 10 5 == 5
80+
assert "15 clamped between 0 and 10 should be 10" $ clamp 0 10 15 == 10
81+
assert "-5 should not be between 0 and 10" $ between 0 10 (-5) == false
82+
assert "5 should be between 0 and 10" $ between 0 10 5 == true
83+
assert "15 should not be between 0 10" $ between 0 10 15 == false
84+
7585
testIntDegree :: AlmostEff
7686
testIntDegree = do
7787
let bot = bottom :: Int

0 commit comments

Comments
 (0)