test
A function that checks other code and fails if it's wrong.
A #[test] function runs under cargo test and passes unless it panics (for example on a failed assert_eq!).
Examples
#[test] fn charges_25_cents_a_day() { assert_eq!(late_fee(3), 75); }runs undercargo testand reportsok.
See also