summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:06:10 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:06:10 +0100
commiteafc42ce8e024a9188505ef355df5b32c63a0386 (patch)
treeb5013318acf7aa7f07e726bc3f1dccf0c952d05a /src
parenta3d5c32751c3d95923e098bbb262e964e023833d (diff)
downloadads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.tar.gz
ads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.tar.xz
ads1x1x-async-eafc42ce8e024a9188505ef355df5b32c63a0386.zip
Add tests for assert function
Diffstat (limited to 'src')
-rw-r--r--src/conversion.rs11
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));