aboutsummaryrefslogtreecommitdiff
path: root/tests/test_update_counters.py
blob: 517e165fb488ea267ddb0f7dc86ef94813216925 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# -*- coding: utf-8 -*-

from z80count.z80count import update_counters


def _make_entry(states, states_met=0):
    return {
        "_t_states_met": states_met,
        "_t_states_or_not_met": states,
    }


def test_unconditional_instruction():
    total, total_cond = update_counters(_make_entry(3), 8)
    assert total == 11
    assert total_cond == 0


def test_conditional_instruction():
    total, total_cond = update_counters(_make_entry(7, 5), 35)
    assert total == 42
    assert total_cond == 40