Commit aee01174 authored by Ashley Yakeley's avatar Ashley Yakeley
Browse files

add test for Data/Fixed module, in libraries folder

parent 1749086a
# Args to compile_and_run are:
# extra compile flags
# extra run flags
# expected process return value, if not zero
test('fixed', normal, compile_and_run, [''])
{-# OPTIONS -Wall -Werror #-}
module Main where
import Data.Fixed
for :: (Monad m) => (a -> m ()) -> [a] -> m ()
for _ [] = return ()
for f (x:xs) = f x >> for f xs
nums :: (Fractional a) => [a]
nums = [0,7,7.1,7.01,7.9,7.09,5 + 7,3.2 - 7.8,5.75 * (-2)]
micronums :: [Micro]
micronums = nums
piconums :: [Pico]
piconums = nums
main :: IO ()
main = do
for (\f -> for (for (putStrLn . f)) [micronums,fmap negate micronums]
) [show,showFixed True]
for (\f -> for (for (putStrLn . f)) [piconums,fmap negate piconums]
) [show,showFixed True]
0.000000
7.000000
7.100000
7.010000
7.900000
7.090000
12.000000
-4.600000
-11.500000
0.000000
-7.000000
-7.100000
-7.010000
-7.900000
-7.090000
-12.000000
4.600000
11.500000
0
7
7.1
7.01
7.9
7.09
12
-4.6
-11.5
0
-7
-7.1
-7.01
-7.9
-7.09
-12
4.6
11.5
0.000000000000
7.000000000000
7.100000000000
7.010000000000
7.900000000000
7.090000000000
12.000000000000
-4.600000000000
-11.500000000000
0.000000000000
-7.000000000000
-7.100000000000
-7.010000000000
-7.900000000000
-7.090000000000
-12.000000000000
4.600000000000
11.500000000000
0
7
7.1
7.01
7.9
7.09
12
-4.6
-11.5
0
-7
-7.1
-7.01
-7.9
-7.09
-12
4.6
11.5
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment