Added To-Do test results

This commit is contained in:
Eduardo Quezada D'Ottone 2023-03-23 22:34:08 -03:00
parent 1da65c4051
commit c922ff69b9
5 changed files with 33 additions and 0 deletions

View File

@ -14,3 +14,6 @@ SINGLE_BATTLE_TEST("Grassy Terrain recovers 1/16th HP at end of turn")
HP_BAR(player, damage: -maxHP / 16); 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")

View File

@ -13,6 +13,7 @@ enum TestResult
TEST_RESULT_INVALID, TEST_RESULT_INVALID,
TEST_RESULT_ERROR, TEST_RESULT_ERROR,
TEST_RESULT_TIMEOUT, TEST_RESULT_TIMEOUT,
TEST_RESULT_TODO,
}; };
struct TestRunner struct TestRunner
@ -138,4 +139,10 @@ s32 MgbaPrintf_(const char *fmt, ...);
#define KNOWN_FAILING \ #define KNOWN_FAILING \
Test_ExpectedResult(TEST_RESULT_FAIL) 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 #endif

View File

@ -601,6 +601,15 @@ extern struct BattleTestRunnerState *gBattleTestRunnerState;
/* Test */ /* 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, ...) \ #define SINGLE_BATTLE_TEST(_name, ...) \
struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \ struct CAT(Result, __LINE__) { MEMBERS(__VA_ARGS__) }; \
static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \ static void CAT(Test, __LINE__)(struct CAT(Result, __LINE__) *, u32, struct BattlePokemon *, struct BattlePokemon *); \

View File

@ -193,6 +193,10 @@ void CB2_TestRunner(void)
result = "ASSUMPTION_FAIL"; result = "ASSUMPTION_FAIL";
color = "\e[33m"; color = "\e[33m";
break; break;
case TEST_RESULT_TODO:
result = "TO_DO";
color = "\e[33m";
break;
case TEST_RESULT_INVALID: case TEST_RESULT_INVALID:
result = "INVALID"; result = "INVALID";
break; break;
@ -211,6 +215,8 @@ void CB2_TestRunner(void)
MgbaPrintf_(":P%s%s\e[0m", color, result); MgbaPrintf_(":P%s%s\e[0m", color, result);
else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL) else if (gTestRunnerState.result == TEST_RESULT_ASSUMPTION_FAIL)
MgbaPrintf_(":A%s%s\e[0m", color, result); 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) else if (gTestRunnerState.expectedResult == gTestRunnerState.result)
MgbaPrintf_(":K%s%s\e[0m", color, result); MgbaPrintf_(":K%s%s\e[0m", color, result);
else else

View File

@ -44,6 +44,7 @@ struct Runner
char *output_buffer; char *output_buffer;
int passes; int passes;
int knownFails; int knownFails;
int todos;
int assumptionFails; int assumptionFails;
int fails; int fails;
int results; int results;
@ -87,6 +88,9 @@ static void handle_read(struct Runner *runner)
case 'K': case 'K':
runner->knownFails++; runner->knownFails++;
goto add_to_results; goto add_to_results;
case 'T':
runner->todos++;
goto add_to_results;
case 'A': case 'A':
runner->assumptionFails++; runner->assumptionFails++;
goto add_to_results; goto add_to_results;
@ -427,6 +431,7 @@ int main(int argc, char *argv[])
int exit_code = 0; int exit_code = 0;
int passes = 0; int passes = 0;
int knownFails = 0; int knownFails = 0;
int todos = 0;
int assumptionFails = 0; int assumptionFails = 0;
int fails = 0; int fails = 0;
int results = 0; int results = 0;
@ -444,6 +449,7 @@ int main(int argc, char *argv[])
exit_code = WEXITSTATUS(wstatus); exit_code = WEXITSTATUS(wstatus);
passes += runners[i].passes; passes += runners[i].passes;
knownFails += runners[i].knownFails; knownFails += runners[i].knownFails;
todos += runners[i].todos;
assumptionFails += runners[i].assumptionFails; assumptionFails += runners[i].assumptionFails;
fails += runners[i].fails; fails += runners[i].fails;
results += runners[i].results; results += runners[i].results;
@ -459,6 +465,8 @@ int main(int argc, char *argv[])
fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes); fprintf(stdout, "- Tests \e[32mPASSED\e[0m: %d\n", passes);
if (knownFails > 0) if (knownFails > 0)
fprintf(stdout, "- Tests \e[33mKNOWN_FAILING\e[0m: %d\n", knownFails); 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) if (fails > 0)
fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails); fprintf(stdout, "- Tests \e[31mFAILED\e[0m : %d\n", fails);
if (assumptionFails > 0) if (assumptionFails > 0)