1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#[cfg(test)]
mod tests {
use crate::hex_display_slice;
#[test]
fn test_hex_display_slice() {
const RAW_DATA: [u8; 64] = [
0x01, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00,
0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x0d,
0x01, 0x05, 0x00, 0x00, 0x64, 0x69, 0x72, 0x2f, 0x66, 0x69, 0x6c, 0x65, 0x32, 0x2e,
0x74, 0x78, 0x74, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x09, 0x00, 0x00, 0x01, 0x00, 0x66,
0x69, 0x6c, 0x65, 0x31, 0x2e, 0x74, 0x78, 0x74,
];
let expected = "\
00000000 01 02 00 00 00 02 00 1b 00 00 00 0f 00 00 00 02 |................|
00000010 00 00 00 02 00 01 00 00 00 01 00 0d 01 05 00 00 |................|
00000020 64 69 72 2f 66 69 6c 65 32 2e 74 78 74 6f 74 68 |dir/file2.txtoth|
00000030 65 72 09 00 00 01 00 66 69 6c 65 31 2e 74 78 74 |er.....file1.txt|";
assert_eq!(hex_display_slice(&RAW_DATA), expected);
}
}
|