mirror of
https://github.com/iritmaximus/haskell.git
synced 2026-10-12 19:13:39 +03:00
Set 1 Ex 4: fix tests, add examples
This commit is contained in:
@@ -47,6 +47,10 @@ quadruple x = todo
|
||||
--
|
||||
-- PS. if you can't remember how the distance is computed, the formula is:
|
||||
-- square root of ((x distance) squared + (y distance) squared)
|
||||
--
|
||||
-- Examples:
|
||||
-- distance 0 0 1 1 ==> 1.4142135...
|
||||
-- distance 1 1 4 5 ==> 5.0
|
||||
|
||||
distance = todo
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ ex4_distance = do
|
||||
y1 <- elements [-5..5]
|
||||
let x2 = x1+deltax
|
||||
let y2 = y1+deltay
|
||||
return $ $(testing [|distance x1 x2 y1 y2|]) (dist=~?)
|
||||
return $ $(testing [|distance x1 y1 x2 y2|]) (dist=~?)
|
||||
|
||||
ex5_eeny_even = forAll_ $ \x -> $(testing [|eeny (2*x)|]) (?=="eeny")
|
||||
ex5_meeny_odd = forAll_ $ \x -> $(testing [|eeny (2*x+1)|]) (?=="meeny")
|
||||
|
||||
Reference in New Issue
Block a user