def test_execute_trap_warning():
    state = new_state()
    instr = opcode_factory.trap16(trap=0b11111)
    name, executefn = decode(instr)
    with pytest.raises(FatalError) as exninfo:
        executefn(state, Instruction(instr, None))
    expected_state = StateChecker(pc=RESET_ADDR)
    expected_text = ('Unknown argument to trap instruction: 31')
    expected_state.check(state)
    assert expected_text == exninfo.value.msg


@pytest.mark.parametrize('name,instr', [('mbkpt16',  opcode_factory.mbkpt16()),
                                        ('sync16',   opcode_factory.sync16()),
                                        ('wand16',   opcode_factory.wand16()),
                                       ])
def test_execute_multicore_instructions(name, instr):
    with pytest.raises(NotImplementedInstError):
        state = new_state()
        name, executefn = decode(instr)
        executefn(state, Instruction(instr, None))


def test_execute_unimpl():
    state = new_state()
    instr = opcode_factory.unimpl()
    name, executefn = decode(instr)
    executefn(state, Instruction(instr, None))
    expected_state = StateChecker(EXCAUSE=0b0100)
    expected_state.check(state)