1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-12-22 14:30:45 +00:00
erc-c/tests/apple2/reflect.c

60 lines
1.1 KiB
C
Raw Normal View History

2018-02-06 20:27:44 +00:00
#include <criterion/criterion.h>
2018-04-13 23:36:02 +00:00
#include "apple2/apple2.h"
#include "apple2/event.h"
#include "vm_di.h"
2018-02-06 20:27:44 +00:00
static apple2 *mach;
static void
setup()
{
mach = apple2_create(100, 100);
2018-04-13 23:36:02 +00:00
mach->paused = false;
mach->debug = false;
vm_di_set(VM_PAUSE_FUNC, NULL);
vm_di_set(VM_DEBUG_FUNC, NULL);
apple2_event_init();
}
static void
teardown()
{
apple2_free(mach);
2018-04-13 23:36:02 +00:00
vm_di_set(VM_PAUSE_FUNC, NULL);
vm_di_set(VM_DEBUG_FUNC, NULL);
}
2018-04-13 23:36:02 +00:00
TestSuite(apple2_event, .init = setup, .fini = teardown);
2018-04-13 23:36:02 +00:00
Test(apple2_event, init)
{
2018-04-13 23:36:02 +00:00
cr_assert_neq(vm_di_get(VM_PAUSE_FUNC), NULL);
cr_assert_neq(vm_di_get(VM_DEBUG_FUNC), NULL);
}
/* Test(apple2_reflect, cpu_info) */
/* Test(apple2_reflect, machine_info) */
2018-04-13 23:36:02 +00:00
Test(apple2_event, pause)
{
2018-04-13 23:36:02 +00:00
apple2_event_pause(mach);
cr_assert_eq(mach->paused, true);
2018-04-13 23:36:02 +00:00
apple2_event_pause(mach);
cr_assert_eq(mach->paused, false);
}
2018-04-13 23:36:02 +00:00
Test(apple2_event, debug)
2018-02-06 20:27:44 +00:00
{
2018-04-13 23:36:02 +00:00
apple2_event_debug(mach);
cr_assert_eq(mach->paused, true);
cr_assert_eq(mach->debug, true);
apple2_event_debug(mach);
cr_assert_eq(mach->paused, true);
cr_assert_eq(mach->debug, true);
2018-02-06 20:27:44 +00:00
}