Author: Antonio Cuni <[email protected]>
Branch: faster-rstruct
Changeset: r80738:35a943788bea
Date: 2015-11-18 08:16 +0100
http://bitbucket.org/pypy/pypy/changeset/35a943788bea/

Log:    re-use BaseStrStorage to implement JIT tests; test_float is failing,
        as expected

diff --git a/rpython/jit/metainterp/test/test_rawmem.py 
b/rpython/jit/metainterp/test/test_rawmem.py
--- a/rpython/jit/metainterp/test/test_rawmem.py
+++ b/rpython/jit/metainterp/test/test_rawmem.py
@@ -1,8 +1,7 @@
 from rpython.jit.metainterp.test.support import LLJitMixin
 from rpython.rtyper.lltypesystem import lltype, rffi
 from rpython.rlib.rawstorage import (alloc_raw_storage, raw_storage_setitem,
-                                     free_raw_storage, raw_storage_getitem,
-                                     str_storage_getitem)
+                                     free_raw_storage, raw_storage_getitem)
 
 
 class RawMemTests(object):
@@ -106,20 +105,6 @@
         res = self.interp_operations(f, [])
         assert res == ord('X')
 
-    def test_str_storage_int(self):
-        import struct
-        data = struct.pack('qq', 42, 100)
-        def f():
-            a = str_storage_getitem(lltype.Signed, data, 0)
-            b = str_storage_getitem(lltype.Signed, data, 8)
-            return a+b
-        res = self.interp_operations(f, [])
-        assert res == 142
-        self.check_operations_history({'getarrayitem_gc_i': 2,
-                                       'int_add': 1,
-                                       'finish': 1})
-
-
 
 class TestRawMem(RawMemTests, LLJitMixin):
 
diff --git a/rpython/jit/metainterp/test/test_strstorage.py 
b/rpython/jit/metainterp/test/test_strstorage.py
new file mode 100644
--- /dev/null
+++ b/rpython/jit/metainterp/test/test_strstorage.py
@@ -0,0 +1,17 @@
+import py
+from rpython.rlib.strstorage import str_storage_getitem
+from rpython.rlib.test.test_strstorage import BaseStrStorageTest
+from rpython.jit.metainterp.test.support import LLJitMixin
+
+class TestStrStorage(BaseStrStorageTest, LLJitMixin):
+
+    # for the individual tests see
+    # ====> ../../../rlib/test/test_strstorage.py
+
+    def str_storage_getitem(self, TYPE, buf, offset):
+        def f():
+            return str_storage_getitem(TYPE, buf, offset)
+        res = self.interp_operations(f, [])
+        self.check_operations_history({'getarrayitem_gc_i': 1,
+                                       'finish': 1})
+        return res
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to