Commit 6e9d93a2 authored by John Zhang's avatar John Zhang

fix tests

malloc_varsize_raw: cast pointer after malloc to correct type
ptr_nonzero: cast NULL to correct type before comparison
malloc_array_of_void: cast pointer after malloc
parent ef944258
......@@ -485,7 +485,7 @@ def test_malloc_varsize_raw():
muops = ll2mu.map_op(llop)
assert [op.opname for op in muops] == ['mu_binop', 'mu_binop', 'mu_ccall', 'mu_getfieldiref', 'mu_store']
assert [op.opname for op in muops] == ['mu_binop', 'mu_binop', 'mu_ccall', 'mu_convop', 'mu_getfieldiref', 'mu_store']
def test_setarrayitem():
......@@ -526,7 +526,7 @@ def test_ptr_nonzero():
rs = varof(mutype.MuRef(Stt))
res = varof(mutype.MU_INT8)
muops = ll2mu.map_op(SpaceOperation('ptr_nonzero', [rs], res))
assert [op.opname for op in muops] == ['mu_cmpop', 'mu_convop']
assert [op.opname for op in muops] == ['mu_convop', 'mu_cmpop', 'mu_convop']
def test_raw_memcopy():
ll2mu = LL2MuMapper()
......@@ -617,7 +617,7 @@ def test_malloc_array_of_void():
Constant(mutype.mu_int64(0), mutype.MU_INT64)], varof(mutype.MuUPtr(T)))
ll2mu = LL2MuMapper()
muops = ll2mu.map_op(llop)
assert len(muops) == 1
assert len(muops) == 2
assert muops[0].opname == 'mu_ccall'
assert muops[0].args[0].value._name == 'malloc'
assert muops[0].args[1].value == 8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment