1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

od: enable hexadecimal output

This commit is contained in:
Wim Hueskes 2016-07-24 21:51:21 +02:00
parent e905c2ec71
commit 36b88f268d
2 changed files with 36 additions and 0 deletions

View file

@ -166,6 +166,38 @@ fn test_dec() {
}
#[test]
fn test_hex16(){
let input : [u8; 9] = [
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff];
let expected_output = unindent("
0000000 2301 6745 ab89 efcd 00ff
0000011
");
let result = new_ucmd!().arg("-x").run_piped_stdin(&input[..]);
assert_empty_stderr!(result);
assert!(result.success);
assert_eq!(result.stdout, expected_output);
}
#[test]
fn test_hex32(){
let input : [u8; 9] = [
0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, 0xff];
let expected_output = unindent("
0000000 67452301 efcdab89 000000ff
0000011
");
let result = new_ucmd!().arg("-X").run_piped_stdin(&input[..]);
assert_empty_stderr!(result);
assert!(result.success);
assert_eq!(result.stdout, expected_output);
}
#[test]
fn test_f32(){