From c922ff69b91ace7dd00eb2303b18b01e4f59120a Mon Sep 17 00:00:00 2001 From: Eduardo Quezada D'Ottone Date: Thu, 23 Mar 2023 22:34:08 -0300 Subject: [PATCH] Added To-Do test results --- test/terrain_grassy.c | 3 +++ test/test.h | 7 +++++++ test/test_battle.h | 9 +++++++++ test/test_runner.c | 6 ++++++ tools/mgba-rom-test-hydra/main.c | 8 ++++++++ 5 files changed, 33 insertions(+) diff --git a/test/terrain_grassy.c b/test/terrain_grassy.c index 6b3a93234..77f8a9927 100644 --- a/test/terrain_grassy.c +++ b/test/terrain_grassy.c @@ -14,3 +14,6 @@ SINGLE_BATTLE_TEST("Grassy Terrain recovers 1/16th HP at end of turn") HP_BAR(player, damage: -maxHP / 16); } } + +TO_DO_BATTLE_TEST("Grassy Terrain increases power of Grass-type moves by 30/50 percent") +TO_DO_BATTLE_TEST("Grassy Terrain decreases power of Earthquake, Magnitude and Bulldoze by 50 percent") diff --git a/test/test.h b/test/test.h index 27475bb48..a05e42a04 100644 --- a/test/test.h +++ b/test/test.h @@ -13,6 +13,7 @@ enum TestResult TEST_RESULT_INVALID, TEST_RESULT_ERROR, TEST_RESULT_TIMEOUT, + TEST_RESULT_TODO, }; struct TestRunner @@ -138,4 +139,10 @@ s32 MgbaPrintf_(const char *fmt, ...); #define KNOWN_FAILING \ Test_ExpectedResult(TEST_RESULT_FAIL) +#define TO_DO \ + Test_ExpectedResult(TEST_RESULT_TODO) + +#define EXPECT_TO_DO \ + Test_ExitWithResult(TEST_RESULT_TODO, "%s:%d: EXPECT_TO_DO", gTestRunnerState.test->filename, __LINE__) + #endif diff --git a/test/test_battle.h b/test/test_battle.h index 16918251b..1e97229bd 100644 --- a/test/test_battle.h +++ b/test/test_battle.h @@ -601,6 +601,15 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState; /* Test */ +#define TO_DO_BATTLE_TEST(_name) \ + SINGLE_BATTLE_TEST("TODO: " _name) \ + { \ + TO_DO; \ + GIVEN { PLAYER(SPECIES_WOBBUFFET); OPPONENT(SPECIES_WOBBUFFET); } \ + WHEN { TURN { } } \ + THEN { EXPECT_TO_DO; } \ + } + #define SINGLE_BATTLE_TEST(_name, ...) \ struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \ static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \ diff --git a/test/test_runner.c b/test/test_runner.c index f2d4d5de3..1d3f14aad 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -193,6 +193,10 @@ void CB2_TestRunner(void) result = "ASSUMPTION_FAIL"; color = "\e[33m"; break; + case TEST_RESULT_TODO: + result = "TO_DO"; + color = "\e[33m"; + break; case TEST_RESULT_INVALID: result = "INVALID"; break; @@ -211,6 +215,8 @@ void CB2_TestRunner(void) MgbaPrintf_(":P%s%s\e[0m", color, result); else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL) MgbaPrintf_(":A%s%s\e[0m", color, result); + else if (gTestRunnerState.result == TEST_RESULT_TODO) + MgbaPrintf_(":T%s%s\e[0m", color, result); else if (gTestRunnerState.expectedResult == gTestRunnerState.result) MgbaPrintf_(":K%s%s\e[0m", color, result); else diff --git a/tools/mgba-rom-test-hydra/main.c b/tools/mgba-rom-test-hydra/main.c index f506d0428..8705225b8 100644 --- a/tools/mgba-rom-test-hydra/main.c +++ b/tools/mgba-rom-test-hydra/main.c @@ -44,6 +44,7 @@ struct Runner char *output_buffer; int passes; int knownFails; + int todos; int assumptionFails; int fails; int results; @@ -87,6 +88,9 @@ static void handle_read(struct Runner *runner) case 'K': runner->knownFails++; goto add_to_results; + case 'T': + runner->todos++; + goto add_to_results; case 'A': runner->assumptionFails++; goto add_to_results; @@ -427,6 +431,7 @@ int main(int argc, char *argv[]) int exit_code = 0; int passes = 0; int knownFails = 0; + int todos = 0; int assumptionFails = 0; int fails = 0; int results = 0; @@ -444,6 +449,7 @@ int main(int argc, char *argv[]) exit_code = WEXITSTATUS(wstatus); passes += runners[i].passes; knownFails += runners[i].knownFails; + todos += runners[i].todos; assumptionFails += runners[i].assumptionFails; fails += runners[i].fails; results += runners[i].results; @@ -459,6 +465,8 @@ int main(int argc, char *argv[]) fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes); if (knownFails > 0) fprintf(stdout, "- Tests \e[33mKNOWN_FAILING\e[0m: %d\n", knownFails); + if (todos > 0) + fprintf(stdout, "- Tests \e[33mTO_DO\e[0m: %d\n", todos); if (fails > 0) fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails); if (assumptionFails > 0)