Mercurial > hg > may
view test/test_complex.yeti @ 57:08b2b9fce25c
Remove the complex constants; they're not very useful and pollute the namespace
author | Chris Cannam |
---|---|
date | Wed, 09 Jan 2013 21:35:37 +0000 |
parents | d037211bf5d7 |
children |
line wrap: on
line source
module test.test_complex; { real, imaginary, complex, magnitude, angle, add, scale } = load complex; { compare } = load test.test; [ "complex": \( compare (complex 1 2) (complex 1 2) and complex (-1) 2 != complex 1 2 ), "real": \( compare (real (complex 3 2)) 3 ), "imaginary": \( compare (imaginary (complex 3 4)) 4 ), "magnitude": \( compare (magnitude (complex (-3) 4)) 5 ), "angle": \( compare (angle (complex 1 0)) 0 and compare (angle (complex 1 1)) (pi/4) and compare (angle (complex 0 1)) (pi/2) and compare (angle (complex (-1) 0)) pi and compare (angle (complex 0 (-1))) (-pi/2) ), "add": \( compare (add (complex 2 3) (complex (-4) 5)) (complex (-2) 8) ), "scale": \( compare (scale 4 (complex 2 3)) (complex 8 12) ), ] is hash<string, () -> boolean>;