Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ASSUMPTIONS not working #3368

Merged
merged 1 commit into from
Oct 11, 2023

Conversation

DizzyEggg
Copy link
Collaborator

Fixes #3043

Example output when ASSUME fails in ASSUMPTION block:

[0] Multi hit Moves hit the maximum amount with Skill Link: ASSUMPTION_FAIL
test/battle/move_effect/multi_hit.c:6: ASSUME failed
[0] Multi hit Moves hit twice 35 Percent of the time: ASSUMPTION_FAIL
[0] Multi hit Moves hit thrice 35 Percent of the time: ASSUMPTION_FAIL
[0] Multi hit Moves hit four times 35 Percent of the time: ASSUMPTION_FAIL
[0] Multi hit Moves hit four times 35 Percent of the time: ASSUMPTION_FAIL
[0] Multi hit Moves hit at least four times with Loaded Dice: ASSUMPTION_FAIL
[0] Multi hit Moves hit five times 50 Percent of the time with Loaded Dice: ASSUMPTION_FAIL
- Tests PASSED:        0
- ASSUMPTIONS_FAILED:  7
- Tests TOTAL:         7

Comment on lines 90 to +91
if (gTestRunnerState.test->runner == &gAssumptionsRunner)
return TRUE;
return 0;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I think I see what I messed up—this code looks like it was expecting to return TRUE if the test should run on this runner, and FALSE if not; but somewhere along the way it changed to returning the process to run on instead.

The reason why you'd want to run the assumptions on every runner is that the tests which are covered by the assumptions run on an arbitrary set of runners. So I wonder if this should say return gTestRunnerI; so that the test runs on all the runners (at zero cost, because we've skipped estimateCost on line 98, which is also important for keeping all the processCosts in sync).

I think atm if we have no tests except:

  • an ASSUMPTIONS block which fails
  • two tests that rely on that block

Then if we make check -j2 the second test will run even though it shouldn't because ASSUMPTIONS and the first test will run on runner 0, and just the second test will run on runner 1 (skipFilename never gets set, because the ASSUMPTIONS doesn't run on that runner).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By atm you mean with or without this PR's changes?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With these changes. (It would be similar without, but swapping runners 0 and 1 because return TRUE; is really return 1;)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Now how to fix it : D

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'd have to double-check (or I can do it later when I'm home from work), but I think just replacing return 0; with return gTestRunnerI; ought to do it 🤞

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like that worked (except with an extra ASSUME failed)

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care about fixing this extra ASSUME failed?

@AsparagusEduardo
Copy link
Collaborator

I applied the changes to current master and then changed:

ASSUMPTIONS
{
-   ASSUME(gBattleMoves[MOVE_BULLET_SEED].effect == EFFECT_MULTI_HIT);
+   ASSUME(gBattleMoves[MOVE_BULLET_SEED].effect == EFFECT_ABSORB);
}

image

Copy link
Collaborator

@AsparagusEduardo AsparagusEduardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the repeated assumption as a minor issue.

@AsparagusEduardo AsparagusEduardo merged commit a4041d0 into rh-hideout:master Oct 11, 2023
1 check passed
@DizzyEggg DizzyEggg deleted the test_assumptions branch October 11, 2023 09:15
@mrgriffin mrgriffin mentioned this pull request Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automatic Test ASSUMPTIONS block is not working
3 participants