From 702f63e427a17081db942ff7f964b682b2e2b663 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 2 Aug 2019 20:08:04 +0200 Subject: [PATCH] test AtomicU64 --- tests/run-pass/atomic.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/run-pass/atomic.rs b/tests/run-pass/atomic.rs index ed9a9f45349..f0b8ec06b90 100644 --- a/tests/run-pass/atomic.rs +++ b/tests/run-pass/atomic.rs @@ -1,8 +1,9 @@ -use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering::*}; +use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicU64, Ordering::*}; fn main() { atomic_bool(); atomic_isize(); + atomic_u64(); } fn atomic_bool() { @@ -50,3 +51,12 @@ fn atomic_isize() { ATOMIC.compare_exchange_weak(0, 1, SeqCst, Acquire).ok(); ATOMIC.compare_exchange_weak(0, 1, SeqCst, SeqCst).ok(); } + +fn atomic_u64() { + static ATOMIC: AtomicU64 = AtomicU64::new(0); + + ATOMIC.store(1, SeqCst); + assert_eq!(ATOMIC.compare_exchange(0, 0x100, AcqRel, Acquire), Err(1)); + assert_eq!(ATOMIC.compare_exchange_weak(1, 0x100, AcqRel, Acquire), Ok(1)); + assert_eq!(ATOMIC.load(Relaxed), 0x100); +} -- 2.44.0