diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-21 09:06:10 +0100 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2018-11-21 09:06:10 +0100 |
commit | eafc42ce8e024a9188505ef355df5b32c63a0386 (patch) | |
tree | b5013318acf7aa7f07e726bc3f1dccf0c952d05a | |
parent | a3d5c32751c3d95923e098bbb262e964e023833d (diff) | |
download | ads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.tar.gz ads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.tar.xz ads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.zip |
Add tests for assert function
-rw-r--r-- | src/conversion.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/conversion.rs b/src/conversion.rs index a3d8203..5e7751c 100644 --- a/src/conversion.rs +++ b/src/conversion.rs @@ -74,6 +74,17 @@ mod tests { } #[test] + fn check_assert_matches() { + assert_invalid_input_data::<()>(Err(Error::InvalidInputData)); + } + + #[test] + #[should_panic] + fn check_assert_fails() { + assert_invalid_input_data::<()>(Ok(0)); + } + + #[test] fn convert_threshold_12_bits() { assert_invalid_input_data::<()>(ic::Resolution12Bit::convert_threshold(2048)); assert_invalid_input_data::<()>(ic::Resolution12Bit::convert_threshold(-2049)); |