view test/test_complex.yeti @ 79:e47d5adb6564

Use RDF description in inferred structure; also report whether it was found in plugin data
author Chris Cannam
date Mon, 04 Mar 2013 17:53:42 +0000
parents 08b2b9fce25c
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>;