diff options
author | Diego Barrios Romero <eldruin@gmail.com> | 2019-03-30 13:25:47 +0200 |
---|---|---|
committer | Diego Barrios Romero <eldruin@gmail.com> | 2019-03-31 13:41:26 +0200 |
commit | ab1221e175f2da577c7a3fb510b5ae5cf41b0697 (patch) | |
tree | 561414aa48f4e3c5f6f9794ab793ab47f295090e | |
parent | c8301c630051d0960e9738a6ab768b8836065e25 (diff) | |
download | ads1x1x-async-ab1221e175f2da577c7a3fb510b5ae5cf41b0697.tar.gz ads1x1x-async-ab1221e175f2da577c7a3fb510b5ae5cf41b0697.tar.xz ads1x1x-async-ab1221e175f2da577c7a3fb510b5ae5cf41b0697.zip |
Extract macro
-rw-r--r-- | tests/common/mod.rs | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 509dbd8..ae3236c 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -82,12 +82,25 @@ macro_rules! impl_new_destroy { }; } -impl_new_destroy!(Ads1013, new_ads1013, destroy_ads1013, ic::Resolution12Bit, I2cTrans, interface::I2cInterface<I2cMock>); -impl_new_destroy!(Ads1113, new_ads1113, destroy_ads1113, ic::Resolution16Bit, I2cTrans, interface::I2cInterface<I2cMock>); -impl_new_destroy!(Ads1014, new_ads1014, destroy_ads1014, ic::Resolution12Bit, I2cTrans, interface::I2cInterface<I2cMock>); -impl_new_destroy!(Ads1114, new_ads1114, destroy_ads1114, ic::Resolution16Bit, I2cTrans, interface::I2cInterface<I2cMock>); -impl_new_destroy!(Ads1015, new_ads1015, destroy_ads1015, ic::Resolution12Bit, I2cTrans, interface::I2cInterface<I2cMock>); -impl_new_destroy!(Ads1115, new_ads1115, destroy_ads1115, ic::Resolution16Bit, I2cTrans, interface::I2cInterface<I2cMock>); +macro_rules! impl_new_destroy_i2c { + ($ic:ident, $create:ident, $destroy:ident, $conv:ty) => { + impl_new_destroy!( + $ic, + $create, + $destroy, + $conv, + I2cTrans, + interface::I2cInterface<I2cMock> + ); + }; +} + +impl_new_destroy_i2c!(Ads1013, new_ads1013, destroy_ads1013, ic::Resolution12Bit); +impl_new_destroy_i2c!(Ads1113, new_ads1113, destroy_ads1113, ic::Resolution16Bit); +impl_new_destroy_i2c!(Ads1014, new_ads1014, destroy_ads1014, ic::Resolution12Bit); +impl_new_destroy_i2c!(Ads1114, new_ads1114, destroy_ads1114, ic::Resolution16Bit); +impl_new_destroy_i2c!(Ads1015, new_ads1015, destroy_ads1015, ic::Resolution12Bit); +impl_new_destroy_i2c!(Ads1115, new_ads1115, destroy_ads1115, ic::Resolution16Bit); #[macro_export] macro_rules! assert_would_block { |