1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-11-18 22:06:01 +00:00
erc-c/tests/mos6502.stat.c

57 lines
1.1 KiB
C
Raw Normal View History

2017-12-04 02:19:17 +00:00
#include <criterion/criterion.h>
#include "mos6502.h"
#include "mos6502.enums.h"
#include "mos6502.tests.h"
2017-12-04 02:19:17 +00:00
TestSuite(mos6502_stat, .init = setup, .fini = teardown);
2017-12-04 02:19:17 +00:00
Test(mos6502_stat, clc)
{
2018-01-05 20:18:39 +00:00
cpu->P = MOS_CARRY | MOS_DECIMAL;
2017-12-04 02:19:17 +00:00
mos6502_handle_clc(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_CARRY, 0);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, cld)
2017-12-04 02:19:17 +00:00
{
2018-01-05 20:18:39 +00:00
cpu->P = MOS_DECIMAL | MOS_CARRY;
2017-12-04 02:19:17 +00:00
mos6502_handle_cld(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_DECIMAL, 0);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, cli)
2017-12-04 02:19:17 +00:00
{
2018-01-05 20:18:39 +00:00
cpu->P = MOS_CARRY | MOS_INTERRUPT;
2017-12-04 02:19:17 +00:00
mos6502_handle_cli(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_INTERRUPT, 0);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, clv)
2017-12-04 02:19:17 +00:00
{
2018-01-05 20:18:39 +00:00
cpu->P = MOS_CARRY | MOS_OVERFLOW;
2017-12-04 02:19:17 +00:00
mos6502_handle_clv(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_OVERFLOW, 0);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, sec)
2017-12-04 02:19:17 +00:00
{
cpu->P = 0;
mos6502_handle_sec(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_CARRY, MOS_CARRY);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, sed)
2017-12-04 02:19:17 +00:00
{
cpu->P = 0;
mos6502_handle_sed(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_DECIMAL, MOS_DECIMAL);
2017-12-04 02:19:17 +00:00
}
Test(mos6502_stat, sei)
2017-12-04 02:19:17 +00:00
{
cpu->P = 0;
mos6502_handle_sei(cpu, 0);
2018-01-05 20:18:39 +00:00
cr_assert_eq(cpu->P & MOS_INTERRUPT, MOS_INTERRUPT);
2017-12-04 02:19:17 +00:00
}