diff options
| author | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-02-09 11:19:52 -0700 |
|---|---|---|
| committer | Mark Simulacrum <mark.simulacrum@gmail.com> | 2018-02-09 16:04:41 -0700 |
| commit | 1335b3da5a80fa4b74b25642e1bb651388bac3a8 (patch) | |
| tree | 8916fa05f761c107c1bf8590fd34e8592f1c0279 /src/libcore/tests | |
| parent | 3bcda48a30b21e46b81a7989deb30a3ba85fb918 (diff) | |
Add fetch_nand.
cc #13226 (the tracking issue)
Diffstat (limited to 'src/libcore/tests')
| -rw-r--r-- | src/libcore/tests/atomic.rs | 14 | ||||
| -rw-r--r-- | src/libcore/tests/lib.rs | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/tests/atomic.rs b/src/libcore/tests/atomic.rs index 9babe24a985..f634fabe503 100644 --- a/src/libcore/tests/atomic.rs +++ b/src/libcore/tests/atomic.rs @@ -49,6 +49,13 @@ fn uint_and() { } #[test] +fn uint_nand() { + let x = AtomicUsize::new(0xf731); + assert_eq!(x.fetch_nand(0x137f, SeqCst), 0xf731); + assert_eq!(x.load(SeqCst), !(0xf731 & 0x137f)); +} + +#[test] fn uint_or() { let x = AtomicUsize::new(0xf731); assert_eq!(x.fetch_or(0x137f, SeqCst), 0xf731); @@ -70,6 +77,13 @@ fn int_and() { } #[test] +fn int_nand() { + let x = AtomicIsize::new(0xf731); + assert_eq!(x.fetch_nand(0x137f, SeqCst), 0xf731); + assert_eq!(x.load(SeqCst), !(0xf731 & 0x137f)); +} + +#[test] fn int_or() { let x = AtomicIsize::new(0xf731); assert_eq!(x.fetch_or(0x137f, SeqCst), 0xf731); diff --git a/src/libcore/tests/lib.rs b/src/libcore/tests/lib.rs index 1c32452f846..9e90313bc0e 100644 --- a/src/libcore/tests/lib.rs +++ b/src/libcore/tests/lib.rs @@ -42,6 +42,7 @@ #![feature(try_from)] #![feature(try_trait)] #![feature(exact_chunks)] +#![feature(atomic_nand)] extern crate core; extern crate test; |
