pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log
self = <pypy.module.pypyjit.test_pypy_c.test_math.TestMath object at 0x00000198be359948>
def test_log(self):
def main(n):
import math
i = 1
s = 0.0
while i < n:
s += math.log(i) - math.log10(i)
i += 1
return s
log = self.run(main, [500])
assert round(log.result, 6) == round(main(500), 6)
loop, = log.loops_by_filename(self.filepath)
> assert loop.match("""
i2 = int_lt(i0, i1)
guard_true(i2, descr=...)
guard_not_invalidated(descr=...)
f1 = cast_int_to_float(i0)
i3 = float_le(f1, 0.0)
guard_false(i3, descr=...)
f2 = call_f(ConstClass(log), f1, descr=<Callf . f EF=2>)
f3 = call_f(ConstClass(log10), f1, descr=<Callf . f EF=2>)
f4 = float_sub(f2, f3)
f5 = float_add(f0, f4)
i4 = int_add(i0, 1)
--TICK--
jump(..., descr=...)
""")
pypy\module\pypyjit\test_pypy_c\test_math.py:19:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pypy\module\pypyjit\test_pypy_c\model.py:186: in match
return matcher.match(expected_src, **kwds)
pypy\module\pypyjit\test_pypy_c\model.py:527: in match
self.match_loop(expected_ops, ignore_ops)
pypy\module\pypyjit\test_pypy_c\model.py:503: in match_loop
self.match_op(op, exp_op)
pypy\module\pypyjit\test_pypy_c\model.py:420: in match_op
self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x00000198be736138>
cond = False
message = "variable mismatch: 'ConstClass(ccall_log)' instead of 'ConstClass(log)'"
def _assert(self, cond, message):
if not cond:
> raise InvalidMatch(message, frame=sys._getframe(1))
E InvalidMatch: variable mismatch: 'ConstClass(ccall_log)' instead of 'ConstClass(log)'
pypy\module\pypyjit\test_pypy_c\model.py:405: InvalidMatch
builder: pypy-c-jit-win-x86-64 build #2370+
test: pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log