Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.8k
[Suggestion][Feedback Wanted] using cmake + google test for writing tests#1464
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
[Suggestion][Feedback Wanted] using cmake + google test for writing tests#1464
Uh oh!
There was an error while loading.Please reload this page.
Conversation
* refactor extract_snippets.py to take arguments from command line* add logging to extract_snippets.py script* add suggested CMakeLists.txt* add google test library, add example refactoring for 2sat and aho korasick tests
adamant-pwn commentedMay 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi, thank you very much for the pull request! I agree that it would be great to rework the testing system. I would say that, ideally, we would like to usecompetitive verifier for this somehow, so that we refer to well-prepared problems on external judges, rather than our own ad hoc test cases. We already use it forhttps://lib.cp-algorithms.com, but that one is a whole library, rather than self-contained snippets. I think we might actually try to run competitive verifier on test files thatrefer to snippets in a similar manner to what's going on athttps://lib.cp-algorithms.com, so essentially we'd change testing files naming scheme to #definePROBLEM"..." at the top to specify online judge that can be used for testing. Do you think it would be realistic to somehow integrate your approach with competitive verifier? Then, we would also be able to use |
yuuurchyk commentedMay 24, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@adamant-pwn thanks for the quick feedback. I will take a look at competitive-verifier, haven't heard about it. Will take a look at it in a week at least :( We'll be in touch then |
Uh oh!
There was an error while loading.Please reload this page.
Hey! This is a draft suggestion PR to move to more industry-oriented approach for testing.
Suggested Changes:
test.sh
)cp-algorithms
tests at once.Side note: I was suspecting that there will be ODR violation error when including the same snippet in multiple source files, but it seems that we're good, since ODR is applicable only to a single translation unit.
Current Changes
extract_snippets.py
script (add logging and command line arguments support)test/
folder, suggested layout:Changes To Be Implemented If This Approach Is Approved
-fsanitize=undefined -fno-sanitize-recover
compiler flagstest_*.cpp
files to use google test framework#pragma once
to all generated snippetsQuestion to Maintainers
What are your thoughts on this? I'm down to rework all the test files, but would like to hear your feedback/suggestions first :)