Adacore GNATtest User’s Guide, section 2.19 Current Limitations states:
- generic tests for nested generic packages and their instantiations are not supported.
So, what is the best way to do testing with my generic package?
Adacore GNATtest User’s Guide, section 2.19 Current Limitations states:
So, what is the best way to do testing with my generic package?
I cannot comment on GNATTest, I write tests myself. But the best way to test is to write tests. ![]()
Aside. You cannot test generics, they are fundamentally non-testable beyond trivial cases. You can test if a macro is textually expanded as expected, but that would tell nothing about how the expansion would work once and if compiled. (It is one of many arguments against generics.) However, you can test a generic instance, if that is in turn testable. So a pragmatic approach is to write tests for generic instances you are going to use.
Thanks, I appreciate your response. Writing tests for generic instances seems quite reasonable.
To implement such tests, does one simply write separate main programs on the instance, and use “asserts” looking for failures?
Or is there a better way to organize things?
This is how I do it. The main program can be quite large of course. It also can be a set of files containing description of inputs and expected outcomes. I do not care about statistics. To me if a single test has failed that is it.
If I wanted a tool, then that would be a project and source management system that would run tests before making a release.