diff --git a/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs b/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs index 7dffe8392..e635358cd 100644 --- a/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/block_unblock_tests.rs @@ -3,6 +3,38 @@ use super::*; static NL: u8 = '\n' as u8; static SPACE: u8 = ' ' as u8; +macro_rules! make_block_test ( + ( $test_id:ident, $test_name:expr, $src:expr, $block:expr, $spec:expr ) => + { + make_spec_test!($test_id, + $test_name, + Input { + src: $src, + non_ascii: false, + ibs: 512, + xfer_stats: StatusLevel::None, + cflags: IConvFlags { + ctable: None, + block: $block, + unblock: None, + swab: false, + sync: false, + noerror: false, + }, + iflags: DEFAULT_IFLAGS, + }, + Output { + dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), + obs: 512, + cflags: DEFAULT_CFO, + oflags: DEFAULT_OFLAGS, + }, + $spec, + format!("./test-resources/FAILED-{}.test", $test_name) + ); + }; +); + #[test] fn block_test_no_nl() { diff --git a/src/uu/dd/src/dd_unit_tests/conversion_tests.rs b/src/uu/dd/src/dd_unit_tests/conversion_tests.rs index 584b92df1..9652a6b76 100644 --- a/src/uu/dd/src/dd_unit_tests/conversion_tests.rs +++ b/src/uu/dd/src/dd_unit_tests/conversion_tests.rs @@ -1,5 +1,55 @@ use super::*; +macro_rules! make_conv_test ( + ( $test_id:ident, $test_name:expr, $src:expr, $ctable:expr, $spec:expr ) => + { + make_spec_test!($test_id, + $test_name, + Input { + src: $src, + non_ascii: false, + ibs: 512, + xfer_stats: StatusLevel::None, + cflags: icf!($ctable), + iflags: DEFAULT_IFLAGS, + }, + Output { + dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), + obs: 512, + cflags: DEFAULT_CFO, + oflags: DEFAULT_OFLAGS, + }, + $spec, + format!("./test-resources/FAILED-{}.test", $test_name) + ); + }; +); + +macro_rules! make_icf_test ( + ( $test_id:ident, $test_name:expr, $src:expr, $icf:expr, $spec:expr ) => + { + make_spec_test!($test_id, + $test_name, + Input { + src: $src, + non_ascii: false, + ibs: 512, + xfer_stats: StatusLevel::None, + cflags: $icf, + iflags: DEFAULT_IFLAGS, + }, + Output { + dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), + obs: 512, + cflags: DEFAULT_CFO, + oflags: DEFAULT_OFLAGS, + }, + $spec, + format!("./test-resources/FAILED-{}.test", $test_name) + ); + }; +); + make_conv_test!( atoe_conv_spec_test, "atoe-conv-spec-test", diff --git a/src/uu/dd/src/dd_unit_tests/mod.rs b/src/uu/dd/src/dd_unit_tests/mod.rs index 5fd1fef19..faeb13e20 100644 --- a/src/uu/dd/src/dd_unit_tests/mod.rs +++ b/src/uu/dd/src/dd_unit_tests/mod.rs @@ -130,87 +130,3 @@ macro_rules! make_spec_test ( }; ); -#[macro_export] -macro_rules! make_conv_test ( - ( $test_id:ident, $test_name:expr, $src:expr, $ctable:expr, $spec:expr ) => - { - make_spec_test!($test_id, - $test_name, - Input { - src: $src, - non_ascii: false, - ibs: 512, - xfer_stats: StatusLevel::None, - cflags: icf!($ctable), - iflags: DEFAULT_IFLAGS, - }, - Output { - dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), - obs: 512, - cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, - }, - $spec, - format!("./test-resources/FAILED-{}.test", $test_name) - ); - }; -); - -#[macro_export] -macro_rules! make_icf_test ( - ( $test_id:ident, $test_name:expr, $src:expr, $icf:expr, $spec:expr ) => - { - make_spec_test!($test_id, - $test_name, - Input { - src: $src, - non_ascii: false, - ibs: 512, - xfer_stats: StatusLevel::None, - cflags: $icf, - iflags: DEFAULT_IFLAGS, - }, - Output { - dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), - obs: 512, - cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, - }, - $spec, - format!("./test-resources/FAILED-{}.test", $test_name) - ); - }; -); - -#[macro_export] -macro_rules! make_block_test ( - ( $test_id:ident, $test_name:expr, $src:expr, $block:expr, $spec:expr ) => - { - make_spec_test!($test_id, - $test_name, - Input { - src: $src, - non_ascii: false, - ibs: 512, - xfer_stats: StatusLevel::None, - cflags: IConvFlags { - ctable: None, - block: $block, - unblock: None, - swab: false, - sync: false, - noerror: false, - }, - iflags: DEFAULT_IFLAGS, - }, - Output { - dst: File::create(format!("./test-resources/FAILED-{}.test", $test_name)).unwrap(), - obs: 512, - cflags: DEFAULT_CFO, - oflags: DEFAULT_OFLAGS, - }, - $spec, - format!("./test-resources/FAILED-{}.test", $test_name) - ); - }; -);