Skip to content

Commit 23332d6

Browse files
emberianPaul Osborne
authored andcommitted
Fix tests
1 parent 1875f22 commit 23332d6

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

test/sys/test_ioctl.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,42 @@ use nix::sys::ioctl::*;
55

66
#[test]
77
fn test_op_none() {
8-
assert_eq!(op_none('q' as u8, 10), 0x0000710A);
9-
assert_eq!(op_none('a' as u8, 255), 0x000061FF);
8+
assert_eq!(io!(b'q', 10), 0x0000710A);
9+
assert_eq!(io!(b'a', 255), 0x000061FF);
1010
}
1111

1212
#[test]
1313
fn test_op_write() {
14-
assert_eq!(op_write('z' as u8, 10, 1), 0x40017A0A);
15-
assert_eq!(op_write('z' as u8, 10, 512), 0x42007A0A);
14+
assert_eq!(iow!(b'z', 10, 1), 0x40017A0A);
15+
assert_eq!(iow!(b'z', 10, 512), 0x42007A0A);
1616
}
1717

1818
#[cfg(target_pointer_width = "64")]
1919
#[test]
2020
fn test_op_write_64() {
21-
assert_eq!(op_write('z' as u8, 10, 1 << 32), 0x40007A0A);
21+
assert_eq!(iow!(b'z', 10, (1 as u64) << 32), 0x40007A0A);
2222
}
2323

2424
#[test]
2525
fn test_op_read() {
26-
assert_eq!(op_read('z' as u8, 10, 1), 0x80017A0A);
27-
assert_eq!(op_read('z' as u8, 10, 512), 0x82007A0A);
26+
assert_eq!(ior!(b'z', 10, 1), 0x80017A0A);
27+
assert_eq!(ior!(b'z', 10, 512), 0x82007A0A);
2828
}
2929

3030
#[cfg(target_pointer_width = "64")]
3131
#[test]
3232
fn test_op_read_64() {
33-
assert_eq!(op_read('z' as u8, 10, 1 << 32), 0x80007A0A);
33+
assert_eq!(ior!(b'z', 10, (1 as u64) << 32), 0x80007A0A);
3434
}
3535

3636
#[test]
3737
fn test_op_read_write() {
38-
assert_eq!(op_read_write('z' as u8, 10, 1), 0xC0017A0A);
39-
assert_eq!(op_read_write('z' as u8, 10, 512), 0xC2007A0A);
38+
assert_eq!(iorw!(b'z', 10, 1), 0xC0017A0A);
39+
assert_eq!(iorw!(b'z', 10, 512), 0xC2007A0A);
4040
}
4141

4242
#[cfg(target_pointer_width = "64")]
4343
#[test]
4444
fn test_op_read_write_64() {
45-
assert_eq!(op_read_write('z' as u8, 10, 1 << 32), 0xC0007A0A);
45+
assert_eq!(iorw!(b'z', 10, (1 as u64) << 32), 0xC0007A0A);
4646
}

test/test.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[macro_use]
12
extern crate nix;
23
extern crate libc;
34
extern crate rand;

0 commit comments

Comments
 (0)