Guido van Rossum | 5de1f8d | 1996-12-10 16:02:14 +0000 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | """ Simple test script for cmathmodule.c |
Guido van Rossum | 228b8e8 | 1997-04-02 06:13:34 +0000 | [diff] [blame^] | 3 | Roger E. Masse |
Guido van Rossum | 5de1f8d | 1996-12-10 16:02:14 +0000 | [diff] [blame] | 4 | """ |
| 5 | import cmath |
Guido van Rossum | 228b8e8 | 1997-04-02 06:13:34 +0000 | [diff] [blame^] | 6 | from test_support import verbose |
Guido van Rossum | 5de1f8d | 1996-12-10 16:02:14 +0000 | [diff] [blame] | 7 | |
Guido van Rossum | 228b8e8 | 1997-04-02 06:13:34 +0000 | [diff] [blame^] | 8 | testdict = {'acos' : 1.0, |
| 9 | 'acosh' : 1.0, |
| 10 | 'asin' : 1.0, |
| 11 | 'asinh' : 1.0, |
| 12 | 'atan' : 0.2, |
| 13 | 'atanh' : 0.2, |
| 14 | 'cos' : 1.0, |
| 15 | 'cosh' : 1.0, |
| 16 | 'exp' : 1.0, |
| 17 | 'log' : 1.0, |
| 18 | 'log10' : 1.0, |
| 19 | 'sin' : 1.0, |
| 20 | 'sinh' : 1.0, |
| 21 | 'sqrt' : 1.0, |
| 22 | 'tan' : 1.0, |
| 23 | 'tanh' : 1.0} |
| 24 | |
| 25 | for func in testdict.keys(): |
| 26 | f = getattr(cmath, func) |
| 27 | r = f(testdict[func]) |
| 28 | if verbose: |
| 29 | print 'Calling %s(%f) = %f' % (func, testdict[func], abs(r)) |
| 30 | |
| 31 | p = cmath.pi |
| 32 | e = cmath.e |
| 33 | if verbose: |
| 34 | print 'PI = ', abs(p) |
| 35 | print 'E = ', abs(e) |