Skip to content

Commit 01de34f

Browse files
author
kamoii
committed
Format test code
1 parent 68f8012 commit 01de34f

File tree

1 file changed

+58
-58
lines changed

1 file changed

+58
-58
lines changed

test/Test/Main.purs

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -8,67 +8,67 @@ import Test.Utils (AlmostEff, assert)
88

99
main :: AlmostEff
1010
main = do
11-
testNumberShow show
12-
testOrderings
13-
testOrdUtils
14-
testIntDivMod
15-
testIntDegree
16-
testRecordInstances
17-
testGenericRep
11+
testNumberShow show
12+
testOrderings
13+
testOrdUtils
14+
testIntDivMod
15+
testIntDegree
16+
testRecordInstances
17+
testGenericRep
1818

1919
foreign import testNumberShow :: (Number -> String) -> AlmostEff
2020

2121
testOrd :: forall a. Ord a => Show a => a -> a -> Ordering -> AlmostEff
2222
testOrd x y ord =
23-
assert
24-
("(compare " <> show x <> " " <> show y <> " ) is not equal to " <> show ord)
25-
$ (compare x y) == ord
26-
27-
nan :: Number
28-
nan = 0.0/0.0
29-
30-
plusInfinity :: Number
31-
plusInfinity = 1.0/0.0
32-
33-
minusInfinity :: Number
34-
minusInfinity = -1.0/0.0
23+
assert
24+
("(compare " <> show x <> " " <> show y <> " ) is not equal to " <> show ord)
25+
$ (compare x y) == ord
3526

3627
testOrderings :: AlmostEff
3728
testOrderings = do
38-
assert "NaN shouldn't be equal to itself" $ nan /= nan
39-
assert "NaN shouldn't be equal to itself" $ (compare nan nan) /= EQ
40-
testOrd 1.0 2.0 LT
41-
testOrd 2.0 1.0 GT
42-
testOrd 1.0 (-2.0) GT
43-
testOrd (-2.0) 1.0 LT
44-
testOrd minusInfinity plusInfinity LT
45-
testOrd minusInfinity 0.0 LT
46-
testOrd plusInfinity 0.0 GT
47-
testOrd plusInfinity minusInfinity GT
48-
testOrd 1.0 nan GT
49-
testOrd nan 1.0 GT
50-
testOrd nan plusInfinity GT
51-
testOrd plusInfinity nan GT
52-
assert "1 > NaN should be false" $ (1.0 > nan) == false
53-
assert "1 < NaN should be false" $ (1.0 < nan) == false
54-
assert "NaN > 1 should be false" $ (nan > 1.0) == false
55-
assert "NaN < 1 should be false" $ (nan < 1.0) == false
56-
assert "NaN == 1 should be false" $ nan /= 1.0
57-
testOrd (1 / 0) 0 EQ
58-
testOrd (mod 1 0) 0 EQ
59-
testOrd 'a' 'b' LT
60-
testOrd 'b' 'A' GT
61-
testOrd "10" "0" GT
62-
testOrd "10" "2" LT
63-
testOrd true true EQ
64-
testOrd false false EQ
65-
testOrd false true LT
66-
testOrd true false GT
67-
testOrd ([] :: Array Int) [] EQ
68-
testOrd [1, 0] [1] GT
69-
testOrd [1] [1, 0] LT
70-
testOrd [1, 1] [1, 0] GT
71-
testOrd [1, -1] [1, 0] LT
29+
assert "NaN shouldn't be equal to itself" $ nan /= nan
30+
assert "NaN shouldn't be equal to itself" $ (compare nan nan) /= EQ
31+
testOrd 1.0 2.0 LT
32+
testOrd 2.0 1.0 GT
33+
testOrd 1.0 (-2.0) GT
34+
testOrd (-2.0) 1.0 LT
35+
testOrd minusInfinity plusInfinity LT
36+
testOrd minusInfinity 0.0 LT
37+
testOrd plusInfinity 0.0 GT
38+
testOrd plusInfinity minusInfinity GT
39+
testOrd 1.0 nan GT
40+
testOrd nan 1.0 GT
41+
testOrd nan plusInfinity GT
42+
testOrd plusInfinity nan GT
43+
assert "1 > NaN should be false" $ (1.0 > nan) == false
44+
assert "1 < NaN should be false" $ (1.0 < nan) == false
45+
assert "NaN > 1 should be false" $ (nan > 1.0) == false
46+
assert "NaN < 1 should be false" $ (nan < 1.0) == false
47+
assert "NaN == 1 should be false" $ nan /= 1.0
48+
testOrd (1 / 0) 0 EQ
49+
testOrd (mod 1 0) 0 EQ
50+
testOrd 'a' 'b' LT
51+
testOrd 'b' 'A' GT
52+
testOrd "10" "0" GT
53+
testOrd "10" "2" LT
54+
testOrd true true EQ
55+
testOrd false false EQ
56+
testOrd false true LT
57+
testOrd true false GT
58+
testOrd ([] :: Array Int) [] EQ
59+
testOrd [1, 0] [1] GT
60+
testOrd [1] [1, 0] LT
61+
testOrd [1, 1] [1, 0] GT
62+
testOrd [1, -1] [1, 0] LT
63+
where
64+
nan :: Number
65+
nan = 0.0/0.0
66+
67+
plusInfinity :: Number
68+
plusInfinity = 1.0/0.0
69+
70+
minusInfinity :: Number
71+
minusInfinity = -1.0/0.0
7272

7373
testOrdUtils :: AlmostEff
7474
testOrdUtils = do
@@ -107,11 +107,11 @@ testIntDivMod = do
107107

108108
testIntDegree :: AlmostEff
109109
testIntDegree = do
110-
let bot = bottom :: Int
111-
assert "degree returns absolute integers" $ degree (-4) == 4
112-
assert "degree returns absolute integers" $ degree 4 == 4
113-
assert "degree returns absolute integers" $ degree bot >= 0
114-
assert "degree does not return out-of-bounds integers" $ degree bot <= top
110+
let bot = bottom :: Int
111+
assert "degree returns absolute integers" $ degree (-4) == 4
112+
assert "degree returns absolute integers" $ degree 4 == 4
113+
assert "degree returns absolute integers" $ degree bot >= 0
114+
assert "degree does not return out-of-bounds integers" $ degree bot <= top
115115

116116
testRecordInstances :: AlmostEff
117117
testRecordInstances = do

0 commit comments

Comments
 (0)