-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
More compile-time tests #2648
More compile-time tests #2648
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I left some comments inline and as for std-format-test
it's mostly for testing the wording of the Text Formatting paper and there is no reason to enable it in C++20.
c28753c
to
baa749c
Compare
Also, I think we have to disable Lines 183 to 184 in c5aafd8
and this test takes tooooo much time to complete. Btw, why disable slow tests not only for CI but also for local runs? |
Yes, these tests are way too slow and not particularly system-specific.
Slow tests are opt in to get decent developer experience by default. |
2bcee2c
to
24c9fc3
Compare
I added one more test for format string check at compile time introduced in 8.0. Not sure that I will come up with some other tests, but at least that's more tests. 😏 I'm a bit concerned about the |
I compared old and new implementations on CI (with ubuntu-20.04 and GCC-11 in C++20 mode) and my PC (to be sure) with all erroring and non-erroring tests already presented. While preparing this comparison, I created another implementation based on PR's one, and it's even faster. Here are the results:
@vitaut, I think since you already suggested making files content inline and the second and third implementations are faster, I should clean the third one a bit and update this PR with it, right? |
Thanks for comprehensive testing. Merging the non-error cases is a good idea.
Yes, please. |
4b4ad87
to
ba2b52f
Compare
And new implementation is here. Still the slowest test, but at least it works now! 😉 |
ba2b52f
to
2be805f
Compare
Another test for compile-time checks of format string added. It makes sure that the incorrect name of arguments produces a compile-time error with |
2be805f
to
c2ba8bc
Compare
c2ba8bc
to
b9b277f
Compare
since it takes too much time to complete, similar to other tests with additional CMake invocation
to make sure that error tests do not fail because they become outdated
b9b277f
to
8c86bfc
Compare
Thank you! |
Depends on #2663.
Originated from the idea that the more compile-time checks, the better.
compile-error-test
test suite allows to check that newly-introduced compile-time checks (C++20) fail successfully. However, there are some nuances.compile-error-test
implementation changed to eliminate usages of header-only library there. It gives a bit faster compilation times (test run times):expect_compile("")
,expect_compile*(...)
,Timings received on my PC, they are not very consistent, but they are within 1 second range for sure. The improvement for doubled amount of checks is not something very impressive, but it allows to add more checks without spending too much time on this test.
Reverse checks introduced to make sure that error tests do not fail because they become outdated. I may be wrong, but currently, wide-narrow checks fail to compile not because of these cases somehow handled, but because
xchar.h
header is not included. So, to be sure that these checks work, we have to add reverse check for them.This is a draft because there are no additional checks introduced (for format string checks, for example), except for reverse checks.