2017-12-04 02:19:17 +00:00
|
|
|
#include <criterion/criterion.h>
|
|
|
|
|
|
|
|
#include "mos6502.h"
|
|
|
|
#include "mos6502.enums.h"
|
2017-12-06 21:57:15 +00:00
|
|
|
#include "mos6502.tests.h"
|
2017-12-04 02:19:17 +00:00
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
TestSuite(mos6502_stat, .init = setup, .fini = teardown);
|
2017-12-04 02:19:17 +00:00
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, clc)
|
|
|
|
{
|
2017-12-04 02:19:17 +00:00
|
|
|
cpu->P = CARRY | DECIMAL;
|
|
|
|
mos6502_handle_clc(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & CARRY, 0);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, cld)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = DECIMAL | CARRY;
|
|
|
|
mos6502_handle_cld(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & DECIMAL, 0);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, cli)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = CARRY | INTERRUPT;
|
|
|
|
mos6502_handle_cli(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & INTERRUPT, 0);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, clv)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = CARRY | OVERFLOW;
|
|
|
|
mos6502_handle_clv(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & OVERFLOW, 0);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, sec)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = 0;
|
|
|
|
mos6502_handle_sec(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & CARRY, CARRY);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, sed)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = 0;
|
|
|
|
mos6502_handle_sed(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & DECIMAL, DECIMAL);
|
|
|
|
}
|
|
|
|
|
2017-12-06 21:57:15 +00:00
|
|
|
Test(mos6502_stat, sei)
|
2017-12-04 02:19:17 +00:00
|
|
|
{
|
|
|
|
cpu->P = 0;
|
|
|
|
mos6502_handle_sei(cpu, 0);
|
|
|
|
cr_assert_eq(cpu->P & INTERRUPT, INTERRUPT);
|
|
|
|
}
|