all repos — mgba @ 287ab91739e5780834066f497db9b78755436912

mGBA Game Boy Advance Emulator

src/gb/test/core.c (view raw)

 1/* Copyright (c) 2013-2016 Jeffrey Pfau
 2 *
 3 * This Source Code Form is subject to the terms of the Mozilla Public
 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 6#include "util/test/suite.h"
 7
 8#include "core/core.h"
 9#include "gb/core.h"
10
11M_TEST_DEFINE(create) {
12	struct mCore* core = GBCoreCreate();
13	assert_non_null(core);
14	assert_true(core->init(core));
15	core->deinit(core);
16}
17
18M_TEST_DEFINE(platform) {
19	struct mCore* core = GBCoreCreate();
20	assert_non_null(core);
21	assert_true(core->platform(core) == PLATFORM_GB);
22	assert_true(core->init(core));
23	core->deinit(core);
24}
25
26M_TEST_DEFINE(reset) {
27	struct mCore* core = GBCoreCreate();
28	assert_non_null(core);
29	assert_true(core->init(core));
30	core->reset(core);
31	core->deinit(core);
32}
33
34M_TEST_DEFINE(loadNullROM) {
35	struct mCore* core = GBCoreCreate();
36	assert_non_null(core);
37	assert_true(core->init(core));
38	assert_false(core->loadROM(core, NULL));
39	core->reset(core);
40	core->deinit(core);
41}
42
43M_TEST_SUITE_DEFINE(GBCore,
44	cmocka_unit_test(create),
45	cmocka_unit_test(platform),
46	cmocka_unit_test(reset),
47	cmocka_unit_test(loadNullROM))