checkedc / checkedc-fork

This was a fork of Checked C used from 2021-2024. The changes have been merged into the original Checked C repo.
Other
26 stars 3 forks source link

Support for Checked-C Macro Test cases #480

Closed arunkumarbhattar closed 1 year ago

dtarditi commented 1 year ago

@arunkumarbhattar I see that these changes clone most of the existing Checked C tests and provide variants of them for the new syntax. I don't think it is a good idea to do this to provide tests for your changes. It'll slow future development on the project down. In general, if you have k features in software, there k! possible combinations of features. If you have n scenarios to test, writing O(k!) tests for those scenarios is too many tests. This testing problem has been studied in other situations. What you want to do is to choose different pairs of features to use so that you can cover the overall space. So you write m tests that pairwise cover the space.

Concretely, what does this mean? We need to consider where we expect to land.

I recommend instead of cloning the files, you modify some of the tests in existing files to use the new syntax. You will still need new tests for some of the features, of course. I recommend:

Given the syntactic nature of the changes, I think it is fine to only modify a small fraction of the tests.

An alternative is to macro-ize some tests so that they use either form. Than we can compile and run more tests, using macros to compile slightly different code. That is more work, though, and I don't recommend doing it to support syntactic forms that we will deprecate.

arunkumarbhattar commented 1 year ago

Thank you for the detailed explanation of your concerns regarding the current testing strategy.

Your recommendation of modifying existing tests to use the new syntax, instead of creating separate tests for each syntax variant, is a more efficient approach. This will ensure that both old and new syntaxes are tested without increasing the number of tests exponentially.

Consequently, I shall add the macro tests within the existing test suites at appropriate places.