Andriamanitra / coctus

Command line tool for playing Clash of Code locally
MIT License
4 stars 2 forks source link

Add numbers to test cases in `clash run` #43

Closed Andriamanitra closed 7 months ago

Andriamanitra commented 7 months ago

When running clash run it would be nice to know the number of the failing test case especially if there are lots of tests. This would allow users to easily run only the failing testcase with clash run --testcases N.

Probably the best way to tackle the issue would be to add a field into the TestCase struct when parsing a clash (maybe serde has a way to do this?). The numbering of tests should start from 1 (similar to how it is on Codingame), so test 1 is the first test (index 0 in test case array) and test 2 is the first validator (index 1 in test case array). When done this way the numbering keeps working nicely even if you run tests in a weird order like clash run --testcases 6,4,2.

Current output:

PASS Test 1
PASS Validator 1
PASS Test 2
PASS Validator 2
... more output ...
11/12 tests passed

Desired output:

PASS #1 Test 1
PASS #2 Validator 1
PASS #3 Test 2
PASS #4 Validator 2
... more output ...
11/12 tests passed