Rename and tidy up the parameterized-test crate

It needed to be renamed to allow it to be published on crates.io, as there's already a parameterized_test crate there.
This commit is contained in:
Oliver Hamlet
2025-08-02 16:05:36 +01:00
parent 8cf7a0adf1
commit b75eced9ea
14 changed files with 334 additions and 167 deletions
+33
View File
@@ -0,0 +1,33 @@
# array-parameterized-test
A few macros to support parameterized test cases where the inputs are defined using an const array. This can be used to concisely define several different parameterized tests that share the same set of inputs.
Use it like this:
```rust
use array_parameterized_test::{test_parameter, parameterized_test};
#[test_parameter]
const INT_INPUTS: [u32; 2] = [1, 2];
#[parameterized_test(INT_INPUTS)]
fn test_with_ints(value: u32) {
assert!(value > 0 && value < 3);
}
```
which produces tests that look like this:
```
test test_with_ints::_1 ... ok
test test_with_ints::_2 ... ok
```
See the tests for more examples.
The macros that implement this functionality may not work with arbitrary array element types. They've been tested with:
- u32
- &str
- (u32, bool)
- Unit-only enums