MCPcopy Index your code
hub / github.com/endbasic/endbasic / check_pin_validation

Function check_pin_validation

std/src/gpio/mod.rs:489–502  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 4

test_gpio_setup_errorsFunction · 0.85
test_gpio_clear_errorsFunction · 0.85
test_gpio_read_errorsFunction · 0.85
test_gpio_write_errorsFunction · 0.85

Calls 2

check_stmt_errFunction · 0.85

Tested by 4

test_gpio_setup_errorsFunction · 0.68
test_gpio_clear_errorsFunction · 0.68
test_gpio_read_errorsFunction · 0.68
test_gpio_write_errorsFunction · 0.68