1
0
mirror of https://github.com/bspeice/aeron-rs synced 2024-12-22 05:48:10 -05:00

Add a test for increment offset

This commit is contained in:
Bradlee Speice 2019-10-03 22:17:08 -04:00
parent c463c96170
commit 4611034b7b

View File

@ -80,4 +80,13 @@ mod tests {
assert_eq!(atomic_buf.get_and_add_i64(0, 1), Ok(16)); assert_eq!(atomic_buf.get_and_add_i64(0, 1), Ok(16));
assert_eq!(atomic_buf.get_and_add_i64(0, 0), Ok(17)); assert_eq!(atomic_buf.get_and_add_i64(0, 0), Ok(17));
} }
#[test]
fn atomic_i64_increment_offset() {
let mut buf = [0, 16, 0, 0, 0, 0, 0, 0, 0];
let atomic_buf = AtomicBuffer::wrap(&mut buf[..]);
assert_eq!(atomic_buf.get_and_add_i64(1, 1), Ok(16));
assert_eq!(atomic_buf.get_and_add_i64(1, 0), Ok(17));
}
} }