exercism / cpp

Exercism exercises in C++.
https://exercism.org/tracks/cpp
MIT License
259 stars 217 forks source link

Update `grade-school` tests #920

Open Elahi-cs opened 3 weeks ago

Elahi-cs commented 3 weeks ago

This PR aims to update all tests in the grade-school exercise. The tests were created manually because the fact that some object-oriented adjustments were necessary made it impossible for the exercise_creation_helper to actually help. I'm hesitant the changes were done correctly because of my lack of experience with the platform, but I've tried to stick to the original test cases where possible and to use the same style with the missing test cases.

@vaeng let me know what you think.

github-actions[bot] commented 3 weeks ago

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!

github-actions[bot] commented 3 weeks ago

Hello. Thanks for opening a PR on Exercism 🙂

We ask that all changes to Exercism are discussed on our Community Forum before being opened on GitHub. To enforce this, we automatically close all PRs that are submitted. That doesn't mean your PR is rejected but that we want the initial discussion about it to happen on our forum where a wide range of key contributors across the Exercism ecosystem can weigh in.

You can use this link to copy this into a new topic on the forum. If we decide the PR is appropriate, we'll reopen it and continue with it, so please don't delete your local branch.

If you're interested in learning more about this auto-responder, please read this blog post.


Note: If this PR has been pre-approved, please link back to this PR on the forum thread and a maintainer or staff member will reopen it.

vaeng commented 2 hours ago

Thanks for the update. Something broke, so the tests are not passing

Elahi-cs commented 2 hours ago

Thanks for the update. Something broke, so the tests are not passing

@vaeng I might need a little bit of guidance on this one. After running configlet, several new tests were added that were not there before. I've done my best to implement them, but some of them are not passing the pipeline tests. An example of this is Cannot add student to same grade in the roster more than once. This was my implementation:

TEST_CASE("Cannot add student to same grade in the roster more than once",
          "[87c871c1-6bde-4413-9c44-73d59a259d83]") {
    grade_school::school school_;
    school_.add("Blair", 2);
    school_.add("James", 2);
    school_.add("James", 2);
    school_.add("Paul", 2);
    REQUIRE(school_.grade(2) == vector<string>{"Blair", "James", "Paul"});
}

However it doesn't seem to be required by the solutions:

/home/runner/work/cpp/cpp/build_exercises/practice/grade-school/grade_school_test.cpp:59: FAILED:
  REQUIRE( school_.grade(2) == vector<string>{"Blair", "James", "Paul"} )
with expansion:
  { "Blair", "James", "James", "Paul" }
  ==
  { "Blair", "James", "Paul" }

Should I disregard these tests and mark them as not included in the tests.toml? Or is there something wrong with either my implementation or the pipeline checks?

Thanks in advance.