* os.py: _exit doesn't exist in all variations of posix

* Added fcmp() to test_support.py and use it in test*.py
This commit is contained in:
Guido van Rossum 1993-01-26 13:04:43 +00:00
parent 93f0740073
commit 35fb82a33f
4 changed files with 45 additions and 19 deletions

View file

@ -71,21 +71,21 @@ if pow(-2L,1) <> -2: raise TestFailed, 'pow(-2L,1)'
if pow(-2L,2) <> 4: raise TestFailed, 'pow(-2L,2)'
if pow(-2L,3) <> -8: raise TestFailed, 'pow(-2L,3)'
#
if pow(0.,0) <> 1.: raise TestFailed, 'pow(0.,0)'
if pow(0.,1) <> 0.: raise TestFailed, 'pow(0.,1)'
if pow(1.,0) <> 1.: raise TestFailed, 'pow(1.,0)'
if pow(1.,1) <> 1.: raise TestFailed, 'pow(1.,1)'
if fcmp(pow(0.,0), 1.): raise TestFailed, 'pow(0.,0)'
if fcmp(pow(0.,1), 0.): raise TestFailed, 'pow(0.,1)'
if fcmp(pow(1.,0), 1.): raise TestFailed, 'pow(1.,0)'
if fcmp(pow(1.,1), 1.): raise TestFailed, 'pow(1.,1)'
#
if pow(2.,0) <> 1.: raise TestFailed, 'pow(2.,0)'
if pow(2.,10) <> 1024.: raise TestFailed, 'pow(2.,10)'
if pow(2.,20) <> 1024.*1024.: raise TestFailed, 'pow(2.,20)'
if pow(2.,30) <> 1024.*1024.*1024.: raise TestFailed, 'pow(2.,30)'
if fcmp(pow(2.,0), 1.): raise TestFailed, 'pow(2.,0)'
if fcmp(pow(2.,10), 1024.): raise TestFailed, 'pow(2.,10)'
if fcmp(pow(2.,20), 1024.*1024.): raise TestFailed, 'pow(2.,20)'
if fcmp(pow(2.,30), 1024.*1024.*1024.): raise TestFailed, 'pow(2.,30)'
#
# XXX These don't work -- negative float to the float power...
#if pow(-2.,0) <> 1.: raise TestFailed, 'pow(-2.,0)'
#if pow(-2.,1) <> -2.: raise TestFailed, 'pow(-2.,1)'
#if pow(-2.,2) <> 4.: raise TestFailed, 'pow(-2.,2)'
#if pow(-2.,3) <> -8.: raise TestFailed, 'pow(-2.,3)'
#if fcmp(pow(-2.,0), 1.): raise TestFailed, 'pow(-2.,0)'
#if fcmp(pow(-2.,1), -2.): raise TestFailed, 'pow(-2.,1)'
#if fcmp(pow(-2.,2), 4.): raise TestFailed, 'pow(-2.,2)'
#if fcmp(pow(-2.,3), -8.): raise TestFailed, 'pow(-2.,3)'
print 'range'
if range(3) <> [0, 1, 2]: raise TestFailed, 'range(3)'