1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-20 04:01:06 +00:00

Project structure refactor (cont'd)

- Move test macros to specific modules.
This commit is contained in:
Tyler 2021-06-01 13:02:02 -07:00
parent ead3c8c8fc
commit 7bc151d561
3 changed files with 82 additions and 84 deletions

View file

@ -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()
{

View file

@ -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",

View file

@ -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)
);
};
);