Attribute Macro test_case::test_case

source ·
#[test_case]
Expand description

Generates tests for given set of data

In general, test case consists of four elements:

  1. (Required) Arguments passed to test body
  2. (Optional) Expected result
  3. (Optional) Test case description
  4. (Required) Test body

When expected result is provided, it is compared against the actual value generated with test body using assert_eq!. Test cases that don’t provide expected result should contain custom assertions within test body or return Result similar to #[test] macro.