diff options
author | Alan Somers <asomers@gmail.com> | 2017-09-17 22:06:03 -0600 |
---|---|---|
committer | Alan Somers <asomers@gmail.com> | 2017-10-02 21:39:18 -0600 |
commit | 6bb37041ba0c5be864eec71418fb65b91994ed7f (patch) | |
tree | 0c09a635296cee3cfb0cb12fdb361daa4a422b40 /test/sys/test_aio.rs | |
parent | 9f4db8a494398226d4feda72ea2c4ed25fa03364 (diff) | |
download | nix-6bb37041ba0c5be864eec71418fb65b91994ed7f.zip |
Add more accessors for AioCb
Diffstat (limited to 'test/sys/test_aio.rs')
-rw-r--r-- | test/sys/test_aio.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/sys/test_aio.rs b/test/sys/test_aio.rs index 67fd0850..c72d4dc7 100644 --- a/test/sys/test_aio.rs +++ b/test/sys/test_aio.rs @@ -21,6 +21,28 @@ fn poll_aio(mut aiocb: &mut AioCb) -> Result<()> { } } +#[test] +fn test_accessors() { + let mut rbuf = vec![0; 4]; + let aiocb = AioCb::from_mut_slice( 1001, + 2, //offset + &mut rbuf, + 42, //priority + SigevNotify::SigevSignal { + signal: Signal::SIGUSR2, + si_value: 99 + }, + LioOpcode::LIO_NOP); + assert_eq!(1001, aiocb.fd()); + assert_eq!(Some(LioOpcode::LIO_NOP), aiocb.lio_opcode()); + assert_eq!(4, aiocb.nbytes()); + assert_eq!(2, aiocb.offset()); + assert_eq!(42, aiocb.priority()); + let sev = aiocb.sigevent().sigevent(); + assert_eq!(Signal::SIGUSR2 as i32, sev.sigev_signo); + assert_eq!(99, sev.sigev_value.sival_ptr as i64); +} + // Tests AioCb.cancel. We aren't trying to test the OS's implementation, only our // bindings. So it's sufficient to check that AioCb.cancel returned any // AioCancelStat value. |