From 87944928aa3a3a0bc59984cf990aaa5d349e069b Mon Sep 17 00:00:00 2001 From: "U-SLAVA-FB3999113\\Slava" Date: Sun, 14 Oct 2007 21:30:30 -0400 Subject: [PATCH] complex/ratios unit test fixes --- extra/math/complex/complex-tests.factor | 46 ++++++++++----------- extra/math/complex/complex.factor | 8 ++-- extra/math/functions/functions-tests.factor | 4 +- extra/math/ratios/ratios-tests.factor | 3 +- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/extra/math/complex/complex-tests.factor b/extra/math/complex/complex-tests.factor index 336ed7d4f5..be512e5052 100755 --- a/extra/math/complex/complex-tests.factor +++ b/extra/math/complex/complex-tests.factor @@ -11,36 +11,36 @@ IN: temporary [ C{ 2 5 } ] [ 2 5 rect> ] unit-test [ 2 5 ] [ C{ 2 5 } >rect ] unit-test -[ C{ 1/2 1 } ] [ 1/2 i + ] unit-test -[ C{ 1/2 1 } ] [ i 1/2 + ] unit-test +[ C{ 1/2 1 } ] [ 1/2 C{ 0 1 } + ] unit-test +[ C{ 1/2 1 } ] [ C{ 0 1 } 1/2 + ] unit-test [ t ] [ C{ 11 64 } C{ 11 64 } = ] unit-test -[ C{ 2 1 } ] [ 2 i + ] unit-test -[ C{ 2 1 } ] [ i 2 + ] unit-test +[ C{ 2 1 } ] [ 2 C{ 0 1 } + ] unit-test +[ C{ 2 1 } ] [ C{ 0 1 } 2 + ] unit-test [ C{ 5 4 } ] [ C{ 2 2 } C{ 3 2 } + ] unit-test [ 5 ] [ C{ 2 2 } C{ 3 -2 } + ] unit-test -[ C{ 1.0 1 } ] [ 1.0 i + ] unit-test +[ C{ 1.0 1 } ] [ 1.0 C{ 0 1 } + ] unit-test -[ C{ 1/2 -1 } ] [ 1/2 i - ] unit-test -[ C{ -1/2 1 } ] [ i 1/2 - ] unit-test -[ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i * + 1 4 / i * - ] unit-test -[ C{ -1/3 -1/4 } ] [ 1 4 / i * 1 3 / 1 2 / i * + - ] unit-test +[ C{ 1/2 -1 } ] [ 1/2 C{ 0 1 } - ] unit-test +[ C{ -1/2 1 } ] [ C{ 0 1 } 1/2 - ] unit-test +[ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i* + 1 4 / i* - ] unit-test +[ C{ -1/3 -1/4 } ] [ 1 4 / i* 1 3 / 1 2 / i* + - ] unit-test [ C{ 1/5 1/4 } ] [ C{ 3/5 1/2 } C{ 2/5 1/4 } - ] unit-test [ 4 ] [ C{ 5 10/3 } C{ 1 10/3 } - ] unit-test -[ C{ 1.0 -1 } ] [ 1.0 i - ] unit-test +[ C{ 1.0 -1 } ] [ 1.0 C{ 0 1 } - ] unit-test -[ C{ 0 1 } ] [ i 1 * ] unit-test -[ C{ 0 1 } ] [ 1 i * ] unit-test -[ C{ 0 1.0 } ] [ 1.0 i * ] unit-test -[ -1 ] [ i i * ] unit-test -[ C{ 0 1 } ] [ 1 i * ] unit-test -[ C{ 0 1 } ] [ i 1 * ] unit-test -[ C{ 0 1/2 } ] [ 1/2 i * ] unit-test -[ C{ 0 1/2 } ] [ i 1/2 * ] unit-test +[ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test +[ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test +[ C{ 0 1.0 } ] [ 1.0 C{ 0 1 } * ] unit-test +[ -1 ] [ C{ 0 1 } C{ 0 1 } * ] unit-test +[ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test +[ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test +[ C{ 0 1/2 } ] [ 1/2 C{ 0 1 } * ] unit-test +[ C{ 0 1/2 } ] [ C{ 0 1 } 1/2 * ] unit-test [ 2 ] [ C{ 1 1 } C{ 1 -1 } * ] unit-test -[ 1 ] [ i -i * ] unit-test +[ 1 ] [ C{ 0 1 } C{ 0 -1 } * ] unit-test -[ -1 ] [ i -i / ] unit-test -[ C{ 0 1 } ] [ 1 -i / ] unit-test +[ -1 ] [ C{ 0 1 } C{ 0 -1 } / ] unit-test +[ C{ 0 1 } ] [ 1 C{ 0 -1 } / ] unit-test [ t ] [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 } = ] unit-test [ C{ -3 4 } ] [ C{ 3 -4 } neg ] unit-test @@ -52,8 +52,8 @@ IN: temporary [ 0 ] [ 0 arg ] unit-test [ 0 ] [ 1 arg ] unit-test [ t ] [ -1 arg 3.14 3.15 between? ] unit-test -[ t ] [ i arg 1.57 1.58 between? ] unit-test -[ t ] [ -i arg -1.58 -1.57 between? ] unit-test +[ t ] [ C{ 0 1 } arg 1.57 1.58 between? ] unit-test +[ t ] [ C{ 0 -1 } arg -1.58 -1.57 between? ] unit-test [ 1 0 ] [ 1 >polar ] unit-test [ 1 ] [ -1 >polar drop ] unit-test diff --git a/extra/math/complex/complex.factor b/extra/math/complex/complex.factor index 942c0c11d0..ecd548fefb 100755 --- a/extra/math/complex/complex.factor +++ b/extra/math/complex/complex.factor @@ -34,10 +34,10 @@ M: complex sqrt >polar swap fsqrt swap 2.0 / polar> ; M: complex hashcode* nip >rect >fixnum swap >fixnum bitxor ; -M: complex pprint-delims drop \ C{ \ } ; - -M: complex >pprint-sequence >rect 2array ; - IN: syntax : C{ \ } [ first2 rect> ] parse-literal ; parsing + +M: complex pprint-delims drop \ C{ \ } ; + +M: complex >pprint-sequence >rect 2array ; diff --git a/extra/math/functions/functions-tests.factor b/extra/math/functions/functions-tests.factor index fdfa450ede..d957eebd2e 100755 --- a/extra/math/functions/functions-tests.factor +++ b/extra/math/functions/functions-tests.factor @@ -17,8 +17,8 @@ IN: temporary [ 4.0 ] [ 2 2 ^ ] unit-test [ 0.25 ] [ 2 -2 ^ ] unit-test [ t ] [ 2 0.5 ^ 2 ^ 2 2.00001 between? ] unit-test -[ t ] [ e pi i * ^ real -1.0 = ] unit-test -[ t ] [ e pi i * ^ imaginary -0.00001 0.00001 between? ] unit-test +[ t ] [ e pi i* ^ real -1.0 = ] unit-test +[ t ] [ e pi i* ^ imaginary -0.00001 0.00001 between? ] unit-test [ t ] [ 0 0 ^ fp-nan? ] unit-test [ 1.0/0.0 ] [ 0 -2 ^ ] unit-test diff --git a/extra/math/ratios/ratios-tests.factor b/extra/math/ratios/ratios-tests.factor index fbc8ee3256..79b0b21d28 100755 --- a/extra/math/ratios/ratios-tests.factor +++ b/extra/math/ratios/ratios-tests.factor @@ -1,4 +1,5 @@ -USING: kernel math math.parser tools.test ; +USING: kernel math math.parser math.ratios math.functions +tools.test ; IN: temporary [ 1 2 ] [ 1/2 >fraction ] unit-test