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

Improvements for test cases #2305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

FherStk
Copy link
Contributor

@FherStk FherStk commented Dec 27, 2023

Related with: #2298

When entering on 'edit test cases', if no data has been entered through the site but the test-cases have been created manually into the file system, a warning will be displayed:
image

  • Choosing the 'infer' option, the zip file will be used to create the test-cases (one entry per file, zero points per entry, default values).
  • Choosing the 'rebuilld' option, the yml file will be used to create the test-cases, but only works with simple problems.

Also, a new option has been added to the form:
image

  • If the zip file is requested to be deleted, all the test-cases will be also removed from the database.
  • If a zip file is uploaded, existing test-cases will be reused if possible (points, pretest and other configurations will be preserved), outdated cases will be removed, and the new ones will be added.

Another addition is the ability to automatically display the test-cases after the problem statement if needed:
image

All the test-cases will append after the problem statement automatically, avoiding inconsistencies between the files and the displayed data:
image

Notice that "pretests" will be displayed first (in order to avoid inconsistencies between the problem statement and the results sent to the judge) and, also, a new option has been added in order to make a test "private":
imagen

Notice that private test will be displayed as hidden to avoid missing the judge test's correlation:
imagen

All these changes are an addition, completely optional, and does not alter the default behavior of the base DMOJ.

I hope you like it, have nice holidays!
Fher

@codecov-commenter
Copy link

codecov-commenter commented Dec 27, 2023

Codecov Report

Attention: Patch coverage is 11.51832% with 169 lines in your changes missing coverage. Please review.

Project coverage is 46.32%. Comparing base (fd7fb05) to head (8fec955).
Report is 15 commits behind head on master.

Files Patch % Lines
judge/models/problem_data.py 8.08% 125 Missing ⚠️
judge/views/problem_data.py 9.37% 29 Missing ⚠️
judge/views/problem.py 0.00% 6 Missing ⚠️
judge/models/problem.py 37.50% 5 Missing ⚠️
judge/utils/problem_data.py 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2305      +/-   ##
==========================================
- Coverage   46.76%   46.32%   -0.45%     
==========================================
  Files         251      253       +2     
  Lines       13317    13534     +217     
==========================================
+ Hits         6228     6269      +41     
- Misses       7089     7265     +176     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@FherStk FherStk mentioned this pull request Dec 27, 2023
@FherStk
Copy link
Contributor Author

FherStk commented Jan 18, 2024

Sorry, but I've found a little bug:

The "pretest" are executed prior to regular tests, so the input / output numeration between the statement and the judge results won't match.

I think that the best option to fix this is to implement this issue: #2031

If you agree, I will create a new PR to implement #2031 and, once integrated, this one will be ready to be integrated too.

Thanks and kind regards,
Fher

@FherStk
Copy link
Contributor Author

FherStk commented Feb 6, 2024

Sorry, but I've found a little bug:

When a test is marked as "pretest" it won't be displayed at the problem statement (if the option is selected within the problem settings), but "pretest" are executed prior to regular tests, so the input / output numeration between the statement and the judge results won't match.

I think that the best option to fix this is to implement this issue: #2031

If you agree, I will create a new PR to implement #2031 and, once integrated, this one will be ready to be integrated too.

Thanks and kind regards, Fher

Well... I see that the #2031 issue is something bigger than I imagined, and I don't feel ready to address it right now. Maybe I should reimagine how the pretest behavior should be treated because:

  1. Pretests are executed before the regular tests.
  2. Pretests exists in order to execute them exclusively during a contest, so the regular tests won't be executed till the end of the contest. Does this mean that regular test's inputs and outputs should be hidden during a contest?
  3. If the answer to the prior question is "yes", this means that only pretest's inputs and outputs should be displayed within the problem statement, but it has no sense to mark all tests as pretests in order to display them all.
  4. So, arrived to this point, maybe should be better to add a new column to mark a test (or pretest) as hidden, but this will not solve the reordering problem when a pretest is selected... I wouldn't like the idea of disabling pretest selection when a problem enabled the "include test cases" option...
  5. Finally, I think that the best option would be to list first the pretests and then the regular test, in the same order as they are but grouped. If a test must be hidden from the statement, it should be marked as it (new "hidden test" option) and a caption like "This is a hidden input / output" will be displayed in the problem statement to avoid gaps.

Sorry, I have so many doubts ^_^U

@FherStk FherStk force-pushed the Infer-test-cases-from-zip branch 3 times, most recently from e9c2173 to e295fd4 Compare August 12, 2024 11:32
@FherStk FherStk marked this pull request as draft August 12, 2024 13:27
@FherStk
Copy link
Contributor Author

FherStk commented Aug 13, 2024

Hi there!

Sorry, I've been a bit out but I'm now ready to finish this implementation. I decided to proceed adding a new column to tests in order to mark them as private, so those private tests's inputs and outputs wont be displayed at the problem statement. Also, pretests will be displayed prior to regular tests in order to avoid correlation issues between the judge results and the statement order.

I also made changes in my devel environment so it will be easier for me to squash the commits and send to you the PR with no conflicts.

Please, feel free to contact me if you need further information. Cheers!
Fher

…lso able to hide test-cases from the problem statement respecting the judge order (pretest firsts).

fixes
@FherStk FherStk force-pushed the Infer-test-cases-from-zip branch from 0f27045 to 8fec955 Compare August 16, 2024 16:03
@FherStk FherStk marked this pull request as ready for review August 16, 2024 16:30
@FherStk
Copy link
Contributor Author

FherStk commented Aug 16, 2024

Hi again,

PR ready to review and merge (if you like).
I also updated the first post, so all the changes are described there.

Cheers!
Fher

@FherStk FherStk mentioned this pull request Aug 18, 2024
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