Skip to content

Commit fff79d5

Browse files
committed
Tests
1 parent 5afb6e0 commit fff79d5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+273
-248
lines changed

examples/passing/Arrays.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ module Main where
22

33
import Prelude.Unsafe (unsafeIndex)
44

5-
test1 arr = arr `unsafeIndex` 0 + arr `unsafeIndex` 1 + 1
5+
test1 arr = arr `unsafeIndex` 0.0 + arr `unsafeIndex` 1.0 + 1.0
66

77
test2 = \arr -> case arr of
88
[x, y] -> x + y
99
[x] -> x
10-
[] -> 0
10+
[] -> 0.0
1111
(x : y : _) -> x + y
1212

1313
data Tree = One Number | Some [Tree]
1414

1515
test3 = \tree sum -> case tree of
1616
One n -> n
17-
Some (n1 : n2 : rest) -> test3 n1 sum * 10 + test3 n2 sum * 5 + sum rest
17+
Some (n1 : n2 : rest) -> test3 n1 sum * 10.0 + test3 n2 sum * 5.0 + sum rest
1818

1919
test4 = \arr -> case arr of
20-
[] -> 0
21-
[_] -> 0
20+
[] -> 0.0
21+
[_] -> 0.0
2222
x : y : xs -> x * y + test4 xs
2323

2424
main = Debug.Trace.trace "Done"

examples/passing/AutoPrelude.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module Main where
22

33
import Debug.Trace
44

5-
f x = x * 10
6-
g y = y - 10
5+
f x = x * 10.0
6+
g y = y - 10.0
77

8-
main = trace $ show $ (f <<< g) 100
8+
main = trace $ show $ (f <<< g) 100.0

examples/passing/BindersInFunctions.purs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ foreign import error
1212
""" :: forall a. String -> a
1313

1414
main =
15-
let ts = tail [1, 2, 3] in
16-
if ts == [2, 3]
15+
let ts = tail [1.0, 2.0, 3.0] in
16+
if ts == [2.0, 3.0]
1717
then Debug.Trace.trace "Done"
1818
else error "Incorrect result from 'tails'."
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module Main where
22

33
foo = bar
4-
where bar r = r + 1
4+
where bar r = r + 1.0
55

6-
r = foo 2
6+
r = foo 2.0
77

88
main = Debug.Trace.trace "Done"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Main where
22

3-
test = ((\x -> x+1) >>> (\x -> x*2)) 4
3+
test = ((\x -> x+1.0) >>> (\x -> x*2.0)) 4.0
44

55
main = Debug.Trace.trace "Done"

examples/passing/Collatz.purs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ infixl 7 %
1818
collatz :: Number -> Number
1919
collatz n = runPure (runST (do
2020
r <- newSTRef n
21-
count <- newSTRef 0
21+
count <- newSTRef 0.0
2222
untilE $ do
23-
modifySTRef count $ (+) 1
23+
modifySTRef count $ (+) 1.0
2424
m <- readSTRef r
25-
writeSTRef r $ if m % 2 == 0 then m / 2 else 3 * m + 1
26-
return $ m == 1
25+
writeSTRef r $ if m % 2.0 == 0.0 then m / 2.0 else 3.0 * m + 1.0
26+
return $ m == 1.0
2727
readSTRef count))
2828

29-
main = Debug.Trace.print $ collatz 1000
29+
main = Debug.Trace.print $ collatz 1000.0

examples/passing/Comparisons.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ foreign import assert
1616
""" :: forall e. Boolean -> Eff (assert :: Assert | e) Unit
1717

1818
main = do
19-
assert (1 < 2)
20-
assert (2 == 2)
21-
assert (3 > 1)
19+
assert (1.0 < 2.0)
20+
assert (2.0 == 2.0)
21+
assert (3.0 > 1.0)
2222
assert ("a" < "b")
2323
assert ("a" == "a")
2424
assert ("z" > "a")

examples/passing/Console.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import Control.Monad.Eff
55
import Debug.Trace
66

77
replicateM_ :: forall m a. (Monad m) => Number -> m a -> m {}
8-
replicateM_ 0 _ = return {}
8+
replicateM_ 0.0 _ = return {}
99
replicateM_ n act = do
1010
act
11-
replicateM_ (n - 1) act
11+
replicateM_ (n - 1.0) act
1212

13-
main = replicateM_ 10 (trace "Hello World!")
13+
main = replicateM_ 10.0 (trace "Hello World!")

examples/passing/DeepArrayBinder.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Control.Monad.Eff
44

55
match2 :: [Number] -> Number
66
match2 (x : y : xs) = x * y + match2 xs
7-
match2 _ = 0
7+
match2 _ = 0.0
88

99
foreign import explode
1010
"""
@@ -13,6 +13,6 @@ foreign import explode
1313
}
1414
""" :: forall eff a. Eff eff a
1515

16-
main = case match2 [1, 2, 3, 4, 5, 6, 7, 8, 9] of
17-
100 -> Debug.Trace.trace "Done"
16+
main = case match2 [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] of
17+
100.0 -> Debug.Trace.trace "Done"
1818
_ -> explode

examples/passing/DeepCase.purs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import Control.Monad.ST
77
f x y =
88
let
99
g = case y of
10-
0 -> x
11-
x -> 1 + x * x
10+
0.0 -> x
11+
x -> 1.0 + x * x
1212
in g + x + y
1313

14-
main = print $ f 1 10
14+
main = print $ f 1.0 10.0

0 commit comments

Comments
 (0)