diff --git a/include/test/battle.h b/include/test/battle.h index 16b492ccad..431e0f98f9 100644 --- a/include/test/battle.h +++ b/include/test/battle.h @@ -734,7 +734,7 @@ struct BattleTestRunnerState bool8 runThen:1; bool8 runFinally:1; bool8 runningFinally:1; - bool8 tearDownBattle:1; + bool8 hasTornDownBattle:1; struct BattleTestData data; u8 *results; u8 checkProgressParameter; diff --git a/include/test/test.h b/include/test/test.h index ccfc589c21..092b603ec0 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -15,6 +15,7 @@ enum TestResult TEST_RESULT_TIMEOUT, TEST_RESULT_CRASH, TEST_RESULT_TODO, + TEST_RESULT_KNOWN_FAIL, }; struct TestRunner @@ -214,7 +215,7 @@ static inline struct Benchmark BenchmarkStop(void) } while (0) #define KNOWN_FAILING \ - Test_ExpectedResult(TEST_RESULT_FAIL) + Test_ExpectedResult(TEST_RESULT_KNOWN_FAIL) #define KNOWN_LEAKING \ Test_ExpectLeaks(TRUE) diff --git a/test/battle/ai/ai_switching.c b/test/battle/ai/ai_switching.c index 46c419f211..41a480135d 100644 --- a/test/battle/ai/ai_switching.c +++ b/test/battle/ai/ai_switching.c @@ -1016,7 +1016,6 @@ AI_SINGLE_BATTLE_TEST("AI_FLAG_SMART_SWITCHING: AI will switch out if main attac AI_SINGLE_BATTLE_TEST("Switch AI: AI will switch into mon with good type matchup and SE move if current mon has no SE move and no stats raised") { - KNOWN_FAILING; // Either remove or replace the function u32 odds = 0, species = SPECIES_NONE, move = MOVE_NONE; PARAMETRIZE { odds = 33; species = SPECIES_SCIZOR; move = MOVE_X_SCISSOR; } PARAMETRIZE { odds = 50; species = SPECIES_DUSCLOPS; move = MOVE_SHADOW_BALL; } diff --git a/test/test_runner.c b/test/test_runner.c index 8ca5b488e3..a1460365e0 100644 --- a/test/test_runner.c +++ b/test/test_runner.c @@ -312,7 +312,9 @@ top: const char *color; const char *result; - if (gTestRunnerState.result == gTestRunnerState.expectedResult) + if (gTestRunnerState.result == gTestRunnerState.expectedResult + || (gTestRunnerState.result == TEST_RESULT_FAIL + && gTestRunnerState.expectedResult == TEST_RESULT_KNOWN_FAIL)) { color = "\e[32m"; Test_MgbaPrintf(":N%s", gTestRunnerState.test->name); @@ -330,7 +332,7 @@ top: switch (gTestRunnerState.result) { case TEST_RESULT_FAIL: - if (gTestRunnerState.expectedResult == TEST_RESULT_FAIL) + if (gTestRunnerState.expectedResult == TEST_RESULT_KNOWN_FAIL) { result = "KNOWN_FAILING"; color = "\e[33m"; @@ -387,7 +389,9 @@ top: Test_MgbaPrintf(":A%s%s\e[0m", color, result); else if (gTestRunnerState.result == TEST_RESULT_TODO) Test_MgbaPrintf(":T%s%s\e[0m", color, result); - else if (gTestRunnerState.expectedResult == gTestRunnerState.result) + else if (gTestRunnerState.expectedResult == gTestRunnerState.result + || (gTestRunnerState.result == TEST_RESULT_FAIL + && gTestRunnerState.expectedResult == TEST_RESULT_KNOWN_FAIL)) Test_MgbaPrintf(":K%s%s\e[0m", color, result); else Test_MgbaPrintf(":F%s%s\e[0m", color, result); diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index a20637b334..7884993a1c 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -181,6 +181,7 @@ static void BattleTest_SetUp(void *data) STATE->battlersCount = 4; break; } + STATE->hasTornDownBattle = FALSE; } static void PrintTestName(void) @@ -1420,8 +1421,11 @@ static void BattleTest_TearDown(void *data) // aborted unexpectedly. ClearFlagAfterTest(); TestFreeConfigData(); - if (STATE->tearDownBattle) + if (!STATE->hasTornDownBattle) + { TearDownBattle(); + STATE->hasTornDownBattle = TRUE; + } } static bool32 BattleTest_CheckProgress(void *data) @@ -1449,7 +1453,6 @@ static bool32 BattleTest_HandleExitWithResult(void *data, enum TestResult result } else { - STATE->tearDownBattle = TRUE; return FALSE; } }