1 USING: kernel math math.constants math.functions math.order
2 tools.test prettyprint ;
5 [ 1 C{ 0 1 } rect> ] must-fail
6 [ C{ 0 1 } 1 rect> ] must-fail
8 [ f ] [ C{ 5 12.5 } 5 = ] unit-test
9 [ f ] [ C{ 5 12.5 } 5 number= ] unit-test
11 [ f ] [ C{ 1.0 2.0 } C{ 1 2 } = ] unit-test
12 [ t ] [ C{ 1.0 2.0 } C{ 1 2 } number= ] unit-test
14 [ f ] [ C{ 1.0 2.3 } C{ 1 2 } = ] unit-test
15 [ f ] [ C{ 1.0 2.3 } C{ 1 2 } number= ] unit-test
17 [ C{ 2 5 } ] [ 2 5 rect> ] unit-test
18 [ 2 5 ] [ C{ 2 5 } >rect ] unit-test
19 [ C{ 1/2 1 } ] [ 1/2 C{ 0 1 } + ] unit-test
20 [ C{ 1/2 1 } ] [ C{ 0 1 } 1/2 + ] unit-test
21 [ t ] [ C{ 11 64 } C{ 11 64 } = ] unit-test
22 [ C{ 2 1 } ] [ 2 C{ 0 1 } + ] unit-test
23 [ C{ 2 1 } ] [ C{ 0 1 } 2 + ] unit-test
24 [ C{ 5 4 } ] [ C{ 2 2 } C{ 3 2 } + ] unit-test
25 [ 5 ] [ C{ 2 2 } C{ 3 -2 } + ] unit-test
26 [ C{ 1.0 1 } ] [ 1.0 C{ 0 1 } + ] unit-test
28 [ C{ 1/2 -1 } ] [ 1/2 C{ 0 1 } - ] unit-test
29 [ C{ -1/2 1 } ] [ C{ 0 1 } 1/2 - ] unit-test
30 [ C{ 1/3 1/4 } ] [ 1 3 / 1 2 / i* + 1 4 / i* - ] unit-test
31 [ C{ -1/3 -1/4 } ] [ 1 4 / i* 1 3 / 1 2 / i* + - ] unit-test
32 [ C{ 1/5 1/4 } ] [ C{ 3/5 1/2 } C{ 2/5 1/4 } - ] unit-test
33 [ 4 ] [ C{ 5 10/3 } C{ 1 10/3 } - ] unit-test
34 [ C{ 1.0 -1 } ] [ 1.0 C{ 0 1 } - ] unit-test
36 [ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test
37 [ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test
38 [ C{ 0.0 1.0 } ] [ 1.0 C{ 0 1 } * ] unit-test
39 [ -1 ] [ C{ 0 1 } C{ 0 1 } * ] unit-test
40 [ C{ 0 1 } ] [ 1 C{ 0 1 } * ] unit-test
41 [ C{ 0 1 } ] [ C{ 0 1 } 1 * ] unit-test
42 [ C{ 0 1/2 } ] [ 1/2 C{ 0 1 } * ] unit-test
43 [ C{ 0 1/2 } ] [ C{ 0 1 } 1/2 * ] unit-test
44 [ 2 ] [ C{ 1 1 } C{ 1 -1 } * ] unit-test
45 [ 1 ] [ C{ 0 1 } C{ 0 -1 } * ] unit-test
47 [ -1 ] [ C{ 0 1 } C{ 0 -1 } / ] unit-test
48 [ C{ 0 1 } ] [ 1 C{ 0 -1 } / ] unit-test
49 [ t ] [ C{ 12 13 } C{ 13 14 } / C{ 13 14 } * C{ 12 13 } = ] unit-test
51 [ C{ -3 4 } ] [ C{ 3 -4 } neg ] unit-test
53 [ 5.0 ] [ C{ 3 4 } abs ] unit-test
54 [ 5.0 ] [ -5.0 abs ] unit-test
56 ! Make sure arguments are sane
57 [ 0.0 ] [ 0 arg ] unit-test
58 [ 0.0 ] [ 1 arg ] unit-test
59 [ t ] [ -1 arg 3.14 3.15 between? ] unit-test
60 [ t ] [ C{ 0 1 } arg 1.57 1.58 between? ] unit-test
61 [ t ] [ C{ 0 -1 } arg -1.58 -1.57 between? ] unit-test
63 [ 1.0 0.0 ] [ 1 >polar ] unit-test
64 [ 1.0 ] [ -1 >polar drop ] unit-test
65 [ t ] [ -1 >polar nip 3.14 3.15 between? ] unit-test
68 [ ] [ C{ 1 4 } tanh drop ] unit-test
69 [ ] [ C{ 1 4 } tan drop ] unit-test
70 [ ] [ C{ 1 4 } coth drop ] unit-test
71 [ ] [ C{ 1 4 } cot drop ] unit-test
73 [ "C{ 1/2 2/3 }" ] [ C{ 1/2 2/3 } unparse ] unit-test