summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
committerDiego Barrios Romero <eldruin@gmail.com>2018-11-21 09:35:37 +0100
commit5485d9655e2ab3a6d04e5f69b246f5db4d2c5936 (patch)
tree84bb1e825656d4c523b65edc5d7780fbb060c8cc /tests
parente4a1ac5a04d021ef026c559354e9913ae59864d8 (diff)
downloadads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.gz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.tar.xz
ads1x1x-async-5485d9655e2ab3a6d04e5f69b246f5db4d2c5936.zip
Code formatting
Diffstat (limited to 'tests')
-rw-r--r--tests/common/mod.rs23
-rw-r--r--tests/construction.rs10
2 files changed, 19 insertions, 14 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs
index d81494f..509dbd8 100644
--- a/tests/common/mod.rs
+++ b/tests/common/mod.rs
@@ -1,10 +1,10 @@
extern crate embedded_hal_mock as hal;
-use self::hal::i2c::{ Mock as I2cMock, Transaction as I2cTrans };
+use self::hal::i2c::{Mock as I2cMock, Transaction as I2cTrans};
extern crate ads1x1x;
-use self::ads1x1x::{ Ads1x1x, interface, ic, SlaveAddr, mode };
+use self::ads1x1x::{ic, interface, mode, Ads1x1x, SlaveAddr};
#[allow(unused)]
-pub const DEVICE_ADDRESS : u8 = 0b100_1000;
+pub const DEVICE_ADDRESS: u8 = 0b100_1000;
pub struct Register;
#[allow(unused)]
@@ -37,16 +37,20 @@ impl BitFlags {
}
pub struct Config {
- pub bits: u16
+ pub bits: u16,
}
#[allow(dead_code)]
impl Config {
pub fn with_high(&self, mask: u16) -> Self {
- Config { bits: self.bits | mask }
+ Config {
+ bits: self.bits | mask,
+ }
}
pub fn with_low(&self, mask: u16) -> Self {
- Config { bits: self.bits & !mask }
+ Config {
+ bits: self.bits & !mask,
+ }
}
pub fn msb(&self) -> u8 {
@@ -75,7 +79,7 @@ macro_rules! impl_new_destroy {
pub fn $destroy<MODE>(dev: Ads1x1x<$iface, ic::$ic, $conv, MODE>) {
dev.$destroy().done();
}
- }
+ };
}
impl_new_destroy!(Ads1013, new_ads1013, destroy_ads1013, ic::Resolution12Bit, I2cTrans, interface::I2cInterface<I2cMock>);
@@ -90,8 +94,7 @@ macro_rules! assert_would_block {
($result: expr) => {
match $result {
Err(nb::Error::WouldBlock) => (),
- _ => panic!("Would not block.")
+ _ => panic!("Would not block."),
}
- }
+ };
}
-
diff --git a/tests/construction.rs b/tests/construction.rs
index 459e5a8..698d06a 100644
--- a/tests/construction.rs
+++ b/tests/construction.rs
@@ -1,7 +1,9 @@
mod common;
-use common::{ new_ads1013, destroy_ads1013, new_ads1113, destroy_ads1113,
- new_ads1014, destroy_ads1014, new_ads1114, destroy_ads1114,
- new_ads1015, destroy_ads1015, new_ads1115, destroy_ads1115 };
+use common::{
+ new_ads1013, destroy_ads1013, new_ads1113, destroy_ads1113,
+ new_ads1014, destroy_ads1014, new_ads1114, destroy_ads1114,
+ new_ads1015, destroy_ads1015, new_ads1115, destroy_ads1115
+};
macro_rules! impl_tests {
($IC:ident, $create:ident, $destroy:ident) => {
@@ -13,7 +15,7 @@ macro_rules! impl_tests {
$destroy(dev);
}
}
- }
+ };
}
impl_tests!(ads1013, new_ads1013, destroy_ads1013);