-
-
Notifications
You must be signed in to change notification settings - Fork 146
Bowling - inline test helper functions setUp and rollMany #944
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
base: main
Are you sure you want to change the base?
Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
@exercism/maintainers-admin I'm not sure if I need to add the [no important files changed] message |
|
@lilyqin7 Thanks for pushing this! I'll read through it now. You do not have to add the |
mk-mxp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That looks great! I like the structure given by the frame comments, but I think we should not give that many details in hints. Leave the math to the student, but help with the domain language.
|
Not all tests pass as they did before. The failing one is The logic of the (changed) test case is actually correct, and it should be like this. @lilyqin7 Can you adjust the example solution If that's too much, I would rather re-add the 0's and not break the existing solutions now. |
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
|
@mk-mxp I believe I have fixed the solution, could you take a look? |
|
@mk-mxp should be fixed now! |
Summary
This PR replaces helper functions (rollMany(), setUp()) with explicit, inline roll calls and frame comments in the bowling exercise tests. This makes tests self-contained and easier for students to understand without analyzing test infrastructure.
Problem
Students have reported confusion with the bowling exercise tests (see
this forum thread
) because helper functions like rollMany(18, 0) obscure what's actually happening in the test scenarios. Students couldn't determine which frame they were looking at or how many rolls had occurred, forcing them to analyze helper function implementations instead of focusing on bowling scoring logic.
Changes Made
Removed setUp() method - each test now explicitly creates its own $game instance
Replaced all rollMany() calls with explicit $game->roll() calls
Added frame comments (e.g., // Frame 1, // Frame 10 - Strike with two bonus rolls) to clarify game structure
Removed unused helper methods (rollMany(), rollSpare(), rollStrike())
Removed unused private $game property
Rationale
This follows the DAMP principle for test code, which prioritizes readability over DRY. While production code should avoid duplication, test code serves as documentation and benefits from explicit, self-contained scenarios. Students can now see exactly what happens in each test without switching to helper functions.
Testing
All existing tests pass without modification to assertions or test logic - only the setup/arrangement code has been expanded for clarity.