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

Sync: Two Bucket #808

Merged
merged 3 commits into from
Sep 27, 2024
Merged

Sync: Two Bucket #808

merged 3 commits into from
Sep 27, 2024

Conversation

tomasnorre
Copy link
Contributor

@tomasnorre tomasnorre commented Sep 24, 2024

Resolves: #807

I have added the "setup" to each function, but there are still some diffs, to the arrange, act, assert.

Which one do you prefer? or do we go for a 3rd option?

One:

public function testMeasureUsingBucketOneOfSize3AndBucketTwoOfSize5StartWithBucketOne(): void
{
    $buckOne = 3;
    $buckTwo = 5;
    $goal = 1;
    $starterBuck = 'one';
 
    $subject = new TwoBucket();
    $solution = $subject->solve($buckOne, $buckTwo, $goal, $starterBuck);
 
    $this->assertEquals(4, $solution->numberOfActions);
    $this->assertEquals('one', $solution->nameOfBucketWithDesiredLiters);
    $this->assertEquals(5, $solution->litersLeftInOtherBucket);
}

Two:

public function testMeasureOneStepUsingBucketOneOfSize1AndBucketTwoOfSize3StartWithBucketTwo(): void
{
    $subject = new TwoBucket();
    $solution = $subject->solve(1, 3, 3, 'two');

    $this->assertEquals(1, $solution->numberOfActions);
    $this->assertEquals('two', $solution->nameOfBucketWithDesiredLiters);
    $this->assertEquals(0, $solution->litersLeftInOtherBucket);
}

As there are 3 assertions, I don't know if you prefer having

$expectedNumberOfActions = 1;
$expectedBucketName = 'two';
$expectedLitersInOtherBucket = 0;

Or keep the assertions as is.

Copy link

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.

[no important files changed]

For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping @exercism/maintainers-admin in a comment. Thank you!

Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

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

Wow, thank you for your quick action!

I'd go with option 2, without extra expected variables. We currently have a mix of both input options, and all input parameters are short enough to easily fit into one line. Same for the output, using variables or an array doesn't make it better.

exercises/practice/two-bucket/TwoBucketTest.php Outdated Show resolved Hide resolved
@mk-mxp mk-mxp added x:action/sync Sync content with its latest version x:knowledge/elementary Little Exercism knowledge required x:module/practice-exercise Work on Practice Exercises x:type/content Work on content (e.g. exercises, concepts) x:size/small Small amount of work x:rep/small Small amount of reputation labels Sep 25, 2024
tomasnorre and others added 2 commits September 25, 2024 09:12
Co-authored-by: mk-mxp <55182845+mk-mxp@users.noreply.github.com>
Copy link
Contributor

@mk-mxp mk-mxp left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your contribution!

@mk-mxp mk-mxp merged commit 9a5cfff into exercism:main Sep 27, 2024
12 checks passed
@tomasnorre tomasnorre deleted the sync-two-bucket branch September 28, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/sync Sync content with its latest version x:knowledge/elementary Little Exercism knowledge required x:module/practice-exercise Work on Practice Exercises x:rep/small Small amount of reputation x:size/small Small amount of work x:type/content Work on content (e.g. exercises, concepts)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#48in24: two-bucket 2024-10-08
2 participants