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

Update grade-school tests #920

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Elahi-cs
Copy link
Contributor

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.

Copy link
Contributor

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

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.

@github-actions github-actions bot closed this Oct 30, 2024
@vaeng vaeng reopened this Oct 30, 2024
@vaeng
Copy link
Contributor

vaeng commented Nov 27, 2024

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

@Elahi-cs
Copy link
Contributor Author

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.

@vaeng
Copy link
Contributor

vaeng commented Nov 27, 2024

The new tests found an "error" in the example solution:

grade_roster.insert(it, name);

I would rather fix this in the example solution, so the test can pass, than to exclude the test.

@Elahi-cs
Copy link
Contributor Author

Elahi-cs commented Nov 29, 2024

The new tests found an "error" in the example solution:

grade_roster.insert(it, name);

I would rather fix this in the example solution, so the test can pass, than to exclude the test.

Thanks for the clarification @vaeng , I will work on fixing the example solution. Follow-up question: Is there a way to run the tests against the example solution locally? When I run cmake --build . -- test_grade-school cmake seems to ignore the rest of the files and just try to compile grade_school_tests.cpp by itself. I don't want to be using the CI pipeline as a compiler/test runner. Am I missing something?

@vaeng
Copy link
Contributor

vaeng commented Nov 29, 2024

When I work locally, I imitate the exercise set-up and write my example code in the cpp and header files. When I am happy with the result I copy everything to the example files and reset the source and headers to their initial state.

I'm sure there is a more elegant solution, but this one is pretty okay.

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.

2 participants