Commits

David Schneider  committed bc55665

update tests

  • Participants
  • Parent commits c4e0750
  • Branches jitframe-on-heap

Comments (0)

Files changed (2)

File rpython/jit/backend/arm/test/test_arch.py

-from rpython.jit.backend.arm import arch
+from rpython.jit.backend.arm import support
 
 def test_mod():
-    assert arch.arm_int_mod(10, 2) == 0
-    assert arch.arm_int_mod(11, 2) == 1
-    assert arch.arm_int_mod(11, 3) == 2
+    assert support.arm_int_mod(10, 2) == 0
+    assert support.arm_int_mod(11, 2) == 1
+    assert support.arm_int_mod(11, 3) == 2
 
 def test_mod2():
-    assert arch.arm_int_mod(-10, 2) == 0
-    assert arch.arm_int_mod(-11, 2) == -1
-    assert arch.arm_int_mod(-11, 3) == -2
+    assert support.arm_int_mod(-10, 2) == 0
+    assert support.arm_int_mod(-11, 2) == -1
+    assert support.arm_int_mod(-11, 3) == -2
 
 def test_mod3():
-    assert arch.arm_int_mod(10, -2) == 0
-    assert arch.arm_int_mod(11, -2) == 1
-    assert arch.arm_int_mod(11, -3) == 2
+    assert support.arm_int_mod(10, -2) == 0
+    assert support.arm_int_mod(11, -2) == 1
+    assert support.arm_int_mod(11, -3) == 2
 
 
 def test_div():
-    assert arch.arm_int_div(-7, 2) == -3
-    assert arch.arm_int_div(9, 2) == 4
-    assert arch.arm_int_div(10, 5) == 2
+    assert support.arm_int_div(-7, 2) == -3
+    assert support.arm_int_div(9, 2) == 4
+    assert support.arm_int_div(10, 5) == 2
 

File rpython/jit/backend/arm/test/test_jump.py

 import random
 import py
-from rpython.jit.backend.x86.test.test_jump import MockAssembler
 from rpython.jit.backend.arm.registers import *
 from rpython.jit.backend.arm.locations import *
 from rpython.jit.backend.arm.regalloc import ARMFrameManager
 
 frame_pos = ARMFrameManager.frame_pos
 
+class MockAssembler:
+    def __init__(self):
+        self.ops = []
+
+    def regalloc_mov(self, from_loc, to_loc):
+        self.ops.append(('mov', from_loc, to_loc))
+
+    def regalloc_push(self, loc):
+        self.ops.append(('push', loc))
+
+    def regalloc_pop(self, loc):
+        self.ops.append(('pop', loc))
+
+    def got(self, expected):
+        print '------------------------ comparing ---------------------------'
+        for op1, op2 in zip(self.ops, expected):
+            print '%-38s| %-38s' % (op1, op2)
+            if op1 == op2:
+                continue
+            assert len(op1) == len(op2)
+            for x, y in zip(op1, op2):
+                if isinstance(x, StackLoc) and isinstance(y, MODRM):
+                    assert x.byte == y.byte
+                    assert x.extradata == y.extradata
+                else:
+                    assert x == y
+        assert len(self.ops) == len(expected)
+        return True
+
 class TestJump(object):
     def setup_method(self, m):
         self.assembler = MockAssembler()