InsightSoftwareConsortium / InsightSoftwareConsortium/ITK
Create Cartesian product testing utility function to test dimensionality combinations
- Dominant language
- C++
- Stars
- 1.7k
- Forks
- 748
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 64
Description
### Description
Due to templates requiring values to be known at compile time, it is currently not possible to create Cartesian products of input/output dimensionality values so that the instantiation of filters that support only some given values can be tested with products of unsupported values.
### Expected behavior
A Create Cartesian product testing utility function is used to test unsupported dimensionality combinations.
### Actual behavior
Input/output dimensionality values that are not supported (e.g. trigger an exception) need to be fully developed/unfolded in tests, e.g.
https://github.com/InsightSoftwareConsortium/ITK/pull/4166/files#r1306746602
### Additional Information
Something along these lines (templates could be used):
```
#include
#include
#include
int main()
{
unsigned int a[4]= {1,2,3,4};
unsigned int b[3] = {1,2,4};
std::vector> prod;
for (int i = 0; i < sizeof(a)/sizeof(a[0]); i++)
{
for (int j = 0; j < sizeof(b)/sizeof(b[0]); j++)
{
prod.push_back(std::make_pair(a[i], b[j]));
}
}
for (auto i : prod)
{
std::cout << i.first << "," << i.second << std::endl;
}
return 0;
}
```
e.g. https://onlinegdb.com/v4xEK5s2H
Contributor guide
Assessment
This issue has not been assessed yet.