array-parameterized-test 1.0.0

Parameterized testing using an input array.
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 14.43 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 300.14 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 5s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • loot/libloot
    41 11 8
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Ortham

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:

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