= #JxnPortable\docs\programmer_examples\MyFractionAlgebra_ArrayTest.jxn


#function $test( $1, $2, ft2 )
-$1
-$2
ft2( $1, $2 )
ft2( $2, $1 )
#endfunction
$test.setDebug 1


#function $test2( $1, $2 )
$1
$2
$1 + $2
$1 - $2
$1 * $2
$1 / $2
! $1 ^ $2  ! not supported for fraction
#endfunction
$test2.setDebug 1


x = @MyFraction( 1, 2 )
y = @MyFraction( 3, 5 )
ia = { 2, 3, 5 }
xa = ia y
ya = ia x

$test( x, y,   $test2 )
$test( x, 5,   $test2 )
$test( x, 2.5, $test2 )
$test( x, ia,  $test2 )

$test( xa, x,   $test2 )
$test( xa, 3,   $test2 )
$test( xa, 2.5, $test2 )
$test( xa, ia,  $test2 )
$test( xa, ya,  $test2 )