exercism / c

Exercism exercises in C.
https://exercism.org/tracks/c
MIT License
298 stars 181 forks source link

queen-attack test that prevents incorrectly accepted answers due to unsigned type. #1012

Closed edu-bm7 closed 2 months ago

edu-bm7 commented 2 months ago

Issue: 1011

A lot of user solutions that I've seen use some type of abs(queen_1.row - queen_2.row) == abs(queen_1.column - queen_2.column);. This test make sure that students are taking into account underflow that happens because of the Unsigned int type.

Tests if Queens can attack each other even when they crossed sides of the board, which is a common position on chest. Also it ensure that the students start to take into account overflows/underflows that happens often in C/C++

github-actions[bot] commented 2 months 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!

edu-bm7 commented 2 months ago

or, for example, adds an edge case that is not worth rerunning all tests for

I do believe that it is a case where re-testing should be consider since the test enforces good practice when coding in C/C++ also makes them search why their solution is wrong.