| 1 | from rpython.jit.backend.arm.helper.assembler import count_reg_args |
| 2 | from rpython.jit.metainterp.history import INT, REF, FLOAT |
| 3 | from rpython.jit.metainterp.resoperation import InputArgInt as BoxInt |
| 4 | from rpython.jit.metainterp.resoperation import InputArgRef as BoxPtr |
| 5 | from rpython.jit.metainterp.resoperation import InputArgFloat as BoxFloat |
| 6 | |
| 7 | |
| 8 | def test_count_reg_args(): |
| 9 | assert count_reg_args([BoxPtr()]) == 1 |
| 10 | assert count_reg_args([BoxPtr()] * 2) == 2 |
| 11 | assert count_reg_args([BoxPtr()] * 3) == 3 |
| 12 | assert count_reg_args([BoxPtr()] * 4) == 4 |
| 13 | assert count_reg_args([BoxPtr()] * 5) == 4 |
| 14 | assert count_reg_args([BoxFloat()] * 1) == 1 |
| 15 | assert count_reg_args([BoxFloat()] * 2) == 2 |
| 16 | assert count_reg_args([BoxFloat()] * 3) == 2 |
| 17 | |
| 18 | assert count_reg_args([BoxInt(), BoxInt(), BoxFloat()]) == 3 |
| 19 | assert count_reg_args([BoxInt(), BoxFloat(), BoxInt()]) == 2 |
| 20 | |
| 21 | assert count_reg_args([BoxInt(), BoxFloat(), BoxInt()]) == 2 |
| 22 | assert count_reg_args([BoxInt(), BoxInt(), BoxInt(), BoxFloat()]) == 3 |