[pypy-svn] r13403 - pypy/dist/pypy/translator/genc/test

arigo at codespeak.net arigo at codespeak.net
Tue Jun 14 20:31:08 CEST 2005


Author: arigo
Date: Tue Jun 14 20:31:05 2005
New Revision: 13403

Added:
   pypy/dist/pypy/translator/genc/test/test_typed.py
      - copied, changed from r13387, pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py
Removed:
   pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py
Log:
All tests pass!  :-)


Deleted: /pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py
==============================================================================
--- /pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py	Tue Jun 14 20:31:05 2005
+++ (empty file)
@@ -1,105 +0,0 @@
-import autopath
-import sys
-import py.test
-from pypy.translator.translator import Translator
-from pypy.translator.test import snippet 
-from pypy.translator.tool.buildpyxmodule import skip_missing_compiler
-
-from pypy.translator.genc.test.test_annotated import TestAnnotatedTestCase as _TestAnnotatedTestCase
-
-
-class TestTypedTestCase(_TestAnnotatedTestCase):
-
-    def getcompiled(self, func):
-        t = Translator(func, simplifying=True)
-        # builds starting-types from func_defs 
-        argstypelist = []
-        if func.func_defaults:
-            for spec in func.func_defaults:
-                if isinstance(spec, tuple):
-                    spec = spec[0] # use the first type only for the tests
-                argstypelist.append(spec)
-        a = t.annotate(argstypelist)
-        a.simplify()
-        t.specialize()
-        t.checkgraphs()
-        return skip_missing_compiler(t.ccompile)
-
-    def test_call_five(self):
-        # --  the result of call_five() isn't a real list, but an rlist
-        #     that can't be converted to a PyListObject
-        def wrapper():
-            lst = snippet.call_five()
-            return len(lst), lst[0]
-        call_five = self.getcompiled(wrapper)
-        result = call_five()
-        assert result == (1, 5)
-
-    def test_get_set_del_slice(self):
-        def get_set_del_nonneg_slice(): # no neg slices for now!
-            l = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
-            del l[:1]
-            bound = len(l)-1
-            if bound >= 0:
-                del l[bound:]
-            del l[2:4]
-            #l[:1] = [3]
-            #bound = len(l)-1
-            #assert bound >= 0
-            #l[bound:] = [9]    no setting slice into lists for now
-            #l[2:4] = [8,11]
-            l[0], l[-1], l[2], l[3] = 3, 9, 8, 11
-
-            list_3_c = l[:2]
-            list_9 = l[5:]
-            list_11_h = l[3:5]
-            return (len(l), l[0], l[1], l[2], l[3], l[4], l[5],
-                    len(list_3_c),  list_3_c[0],  list_3_c[1],
-                    len(list_9),    list_9[0],
-                    len(list_11_h), list_11_h[0], list_11_h[1])
-        fn = self.getcompiled(get_set_del_nonneg_slice)
-        result = fn()
-        assert result == (6, 3, 'c', 8, 11, 'h', 9,
-                          2, 3, 'c',
-                          1, 9,
-                          2, 11, 'h')
-
-    def test_slice_long(self):
-        "the parent's test_slice_long() makes no sense here"
-
-    def test_int_overflow(self):
-        fn = self.getcompiled(snippet.add_func)
-        raises(OverflowError, fn, sys_maxint())
-
-    def test_int_div_ovf_zer(self): # 
-        py.test.skip("right now aborting python with Floating Point Error!")
-        fn = self.getcompiled(snippet.div_func)
-        raises(OverflowError, fn, -1)
-        raises(ZeroDivisionError, fn, 0)
-
-    def test_int_mod_ovf_zer(self):
-        py.test.skip("right now aborting python with Floating Point Error!")        
-        fn = self.getcompiled(snippet.mod_func)
-        raises(OverflowError, fn, -1)
-        raises(ZeroDivisionError, fn, 0)
-
-    def test_int_rshift_val(self):
-        fn = self.getcompiled(snippet.rshift_func)
-        raises(ValueError, fn, -1)
-
-    def test_int_lshift_ovf_val(self):
-        fn = self.getcompiled(snippet.lshift_func)
-        raises(ValueError, fn, -1)
-        raises(OverflowError, fn, 1)
-
-    def test_int_unary_ovf(self):
-        fn = self.getcompiled(snippet.unary_func)
-        for i in range(-3,3):
-            assert fn(i) == (-(i), abs(i-1))
-        raises (OverflowError, fn, -sys_maxint()-1)
-        raises (OverflowError, fn, -sys_maxint())
-
-def sys_maxint():
-    if sys.maxint != 2147483647:
-        py.test.skip("genc ovf incomplete: int might differ from long")
-    return sys.maxint

Copied: pypy/dist/pypy/translator/genc/test/test_typed.py (from r13387, pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py)
==============================================================================
--- pypy/dist/pypy/translator/genc/test/inprogress_test_typed.py	(original)
+++ pypy/dist/pypy/translator/genc/test/test_typed.py	Tue Jun 14 20:31:05 2005
@@ -72,13 +72,11 @@
         raises(OverflowError, fn, sys_maxint())
 
     def test_int_div_ovf_zer(self): # 
-        py.test.skip("right now aborting python with Floating Point Error!")
         fn = self.getcompiled(snippet.div_func)
         raises(OverflowError, fn, -1)
         raises(ZeroDivisionError, fn, 0)
 
     def test_int_mod_ovf_zer(self):
-        py.test.skip("right now aborting python with Floating Point Error!")        
         fn = self.getcompiled(snippet.mod_func)
         raises(OverflowError, fn, -1)
         raises(ZeroDivisionError, fn, 0)



More information about the Pypy-commit mailing list