PARAMETRIZE_LABEL in test/species.c
PARAMETRIZE_LABEL is like PARAMETRIZE, except that it allows the user to provide a label which will be displayed in the test name line. This is useful for tracking _which_ PARAMETRIZE case failed in the situation where the numbers are unwieldy.
This commit is contained in:
parent
62ce29d0e9
commit
1fea6b83cc
2 changed files with 22 additions and 7 deletions
|
@ -215,6 +215,8 @@ static inline struct Benchmark BenchmarkStop(void)
|
|||
|
||||
#define PARAMETRIZE if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter)
|
||||
|
||||
#define PARAMETRIZE_LABEL(f, label) if (gFunctionTestRunnerState->parameters++ == gFunctionTestRunnerState->runParameter && (MgbaPrintf_(":N%s: " f " (%d/%d)", gTestRunnerState.test->name, label, gFunctionTestRunnerState->runParameter + 1, gFunctionTestRunnerState->parameters), 1))
|
||||
|
||||
#define TO_DO \
|
||||
do { \
|
||||
Test_ExpectedResult(TEST_RESULT_TODO); \
|
||||
|
|
|
@ -6,12 +6,16 @@ TEST("Form species ID tables are shared between all forms")
|
|||
{
|
||||
u32 i;
|
||||
u32 species = SPECIES_NONE;
|
||||
const u16 *formSpeciesIdTable;
|
||||
for (i = 0; i < NUM_SPECIES; i++)
|
||||
{
|
||||
if (gSpeciesInfo[i].formSpeciesIdTable) PARAMETRIZE { species = i; }
|
||||
if (gSpeciesInfo[i].formSpeciesIdTable)
|
||||
{
|
||||
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
||||
}
|
||||
}
|
||||
|
||||
const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
||||
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
||||
for (i = 0; formSpeciesIdTable[i] != FORM_SPECIES_END; i++)
|
||||
{
|
||||
u32 formSpeciesId = formSpeciesIdTable[i];
|
||||
|
@ -23,13 +27,18 @@ TEST("Form change tables contain only forms in the form species ID table")
|
|||
{
|
||||
u32 i, j;
|
||||
u32 species = SPECIES_NONE;
|
||||
const struct FormChange *formChangeTable;
|
||||
const u16 *formSpeciesIdTable;
|
||||
for (i = 0; i < NUM_SPECIES; i++)
|
||||
{
|
||||
if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; }
|
||||
if (gSpeciesInfo[i].formChangeTable)
|
||||
{
|
||||
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
||||
}
|
||||
}
|
||||
|
||||
const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable;
|
||||
const u16 *formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
||||
formChangeTable = gSpeciesInfo[species].formChangeTable;
|
||||
formSpeciesIdTable = gSpeciesInfo[species].formSpeciesIdTable;
|
||||
EXPECT(formSpeciesIdTable);
|
||||
|
||||
for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++)
|
||||
|
@ -51,12 +60,16 @@ TEST("Form change targets have the appropriate species flags")
|
|||
{
|
||||
u32 i;
|
||||
u32 species = SPECIES_NONE;
|
||||
const struct FormChange *formChangeTable;
|
||||
for (i = 0; i < NUM_SPECIES; i++)
|
||||
{
|
||||
if (gSpeciesInfo[i].formChangeTable) PARAMETRIZE { species = i; }
|
||||
if (gSpeciesInfo[i].formChangeTable)
|
||||
{
|
||||
PARAMETRIZE_LABEL("%S", gSpeciesInfo[i].speciesName) { species = i; }
|
||||
}
|
||||
}
|
||||
|
||||
const struct FormChange *formChangeTable = gSpeciesInfo[species].formChangeTable;
|
||||
formChangeTable = gSpeciesInfo[species].formChangeTable;
|
||||
for (i = 0; formChangeTable[i].method != FORM_CHANGE_TERMINATOR; i++)
|
||||
{
|
||||
const struct SpeciesInfo *targetSpeciesInfo = &gSpeciesInfo[formChangeTable[i].targetSpecies];
|
||||
|
|
Loading…
Reference in a new issue