PennMUSH Community

root/1.8.3/trunk/test/testmath.pl

Revision 1167, 1.8 kB (checked in by shawnw, 8 months ago)

Merge devel into trunk for p6 release

Line 
1 run tests:
2 test('abs.1', $god, 'think abs(-1)', '1');
3 test('abs.2', $god, 'think abs(-1.5)', '1.5');
4 test('abs.3', $god, 'think abs(1)', '1');
5 test('abs.4', $god, 'think abs(0)', '0');
6 test('abs.5', $god, 'think abs(-0)', '0');
7 test('abs.6', $god, 'think abs(99999999999)', '99999999999');
8 test('abs.7', $god, 'think abs(-99999999999)', '99999999999');
9
10 test('cos.1',$god, 'think cos(90,d)', '^-?0\s*$');
11 test('cos.2',$god, 'think cos(pi(),r)', '^-1\s*$');
12 test('cos.3',$god, 'think cos(pi())', '^-1\s*$');
13
14 test('acos.1',$god, 'think acos(cos(90,d),d)', '^90\s*$');
15 test('acos.2',$god, 'think acos(cos(1,r))', '^1\s*$');
16 test('acos.3',$god, 'think acos(cos(1,r),r)', '^1\s*$');
17
18 test('sin.1',$god, 'think sin(90,d)', '^1\s*$');
19 test('sin.2',$god, 'think sin(pi(),r)', '^-?0\s*$');
20 test('sin.3',$god, 'think sin(pi())', '^-?0\s*$');
21
22 test('asin.1',$god, 'think asin(sin(90,d),d)', '^90\s*$');
23 test('asin.2',$god, 'think asin(sin(1,r))', '^1\s*$');
24 test('asin.3',$god, 'think asin(sin(1,r),r)', '^1\s*$');
25
26 test('tan.1',$god, 'think tan(45,d)', '^1\s*$');
27 test('tan.2',$god, 'think tan(pi(),r)', '^-?0\s*$');
28 test('tan.3',$god, 'think tan(pi())', '^-?0\s*$');
29
30 test('atan.1',$god, 'think atan(tan(45,d),d)', '^45\s*$');
31 test('atan.2',$god, 'think atan(tan(1,r))', '^1\s*$');
32 test('atan.3',$god, 'think atan(tan(1,r),r)', '^1\s*$');
33
34 test('ctu.1',$god, 'think ctu(90,d,r)', '^1.570\d*\s*$');
35 test('ctu.2',$god, 'think ctu(pi(),r,d)','^180(\.00\d*)?\s*$');
36
37 test('sqrt.1', $god, 'think sqrt(4)', '2');
38 test('sqrt.2', $god, 'think sqrt(-1)', '#-1 IMAGINARY NUMBER');
39
40 test('root.1', $god, 'think root(4,2)', '2');
41 test('root.2', $god, 'think root(-1,2)', '#-1 IMAGINARY NUMBER');
42 test('root.3', $god, 'think root(27, 3)', '3');
43 test('root.4', $god, 'think root(-27, 3)', '-3');
44 $god->command('@config/set float_precision=10');
45 test('root.5', $god, 'think root(125, 5)', '2.6265278044');
Note: See TracBrowser for help on using the browser.