Common checks for pin number validation. The given input `fmt` string contains the command to test with a placeholder `_PIN` for where the pin number goes. The `short_prefix` and `long_prefix` contain possible prefixes for the error messages.
(short_prefix: &str, long_prefix: &str, fmt: &str)
| 487 | /// where the pin number goes. The `short_prefix` and `long_prefix` contain possible prefixes |
| 488 | /// for the error messages. |
| 489 | fn check_pin_validation(short_prefix: &str, long_prefix: &str, fmt: &str) { |
| 490 | check_stmt_compilation_err( |
| 491 | format!(r#"{}BOOLEAN is not a number"#, short_prefix), |
| 492 | &fmt.replace("_PIN_", "TRUE"), |
| 493 | ); |
| 494 | check_stmt_err( |
| 495 | format!(r#"{}Pin number 123456789 is too large"#, long_prefix), |
| 496 | &fmt.replace("_PIN_", "123456789"), |
| 497 | ); |
| 498 | check_stmt_err( |
| 499 | format!(r#"{}Pin number -1 must be positive"#, long_prefix), |
| 500 | &fmt.replace("_PIN_", "-1"), |
| 501 | ); |
| 502 | } |
| 503 | |
| 504 | /// Creates a machine backed by `MockPins` pre-seeded with `reads` and returns both the machine |
| 505 | /// and a handle to inspect the trace afterwards. |