summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-01-21 15:36:40 (GMT)
committerGuido van Rossum <guido@python.org>1993-01-21 15:36:40 (GMT)
commit80530ce8754956c8d5349d4644dc83113a63cfc1 (patch)
treea740c12cd745e7278fb0936ac420a436ae57cf7a /Lib/test
parent9672e44842c59e63920605a4c7ffab7345e73db4 (diff)
downloadcpython-80530ce8754956c8d5349d4644dc83113a63cfc1.zip
cpython-80530ce8754956c8d5349d4644dc83113a63cfc1.tar.gz
cpython-80530ce8754956c8d5349d4644dc83113a63cfc1.tar.bz2
* Add some more tests for numbers
* mainloop.py: don't use select unless absolutely necessary (for Mac)
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_types.py21
-rw-r--r--Lib/test/testall.out3
2 files changed, 24 insertions, 0 deletions
diff --git a/Lib/test/test_types.py b/Lib/test/test_types.py
index fb6e934..e14fa3a 100644
--- a/Lib/test/test_types.py
+++ b/Lib/test/test_types.py
@@ -60,6 +60,27 @@ if long(1.9) == 1L == long(1.1) and long(-1.1) == -1L == long(-1.9): pass
else: raise TestFailed, 'long() does not round properly'
if float(1) == 1.0 and float(-1) == -1.0 and float(0) == 0.0: pass
else: raise TestFailed, 'float() does not work properly'
+print '6.4.1 32-bit integers'
+if 12 + 24 <> 36: raise TestFailed, 'int op'
+if 12 + (-24) <> -12: raise TestFailed, 'int op'
+if (-12) + 24 <> 12: raise TestFailed, 'int op'
+if (-12) + (-24) <> -36: raise TestFailed, 'int op'
+if not 12 < 24: raise TestFailed, 'int op'
+if not -24 < -12: raise TestFailed, 'int op'
+print '6.4.2 Long integers'
+if 12L + 24L <> 36L: raise TestFailed, 'long op'
+if 12L + (-24L) <> -12L: raise TestFailed, 'long op'
+if (-12L) + 24L <> 12L: raise TestFailed, 'long op'
+if (-12L) + (-24L) <> -36L: raise TestFailed, 'long op'
+if not 12L < 24L: raise TestFailed, 'long op'
+if not -24L < -12L: raise TestFailed, 'long op'
+print '6.4.3 Floating point numbers'
+if 12.0 + 24.0 <> 36.0: raise TestFailed, 'float op'
+if 12.0 + (-24.0) <> -12.0: raise TestFailed, 'float op'
+if (-12.0) + 24.0 <> 12.0: raise TestFailed, 'float op'
+if (-12.0) + (-24.0) <> -36.0: raise TestFailed, 'float op'
+if not 12.0 < 24.0: raise TestFailed, 'float op'
+if not -24.0 < -12.0: raise TestFailed, 'float op'
print '6.5 Sequence types'
diff --git a/Lib/test/testall.out b/Lib/test/testall.out
index 6e6fe91..f81849b 100644
--- a/Lib/test/testall.out
+++ b/Lib/test/testall.out
@@ -124,6 +124,9 @@ test_types
6.2 Boolean operations
6.3 Comparisons
6.4 Numeric types (mostly conversions)
+6.4.1 32-bit integers
+6.4.2 Long integers
+6.4.3 Floating point numbers
6.5 Sequence types
6.5.1 Strings
6.5.2 Tuples