diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2016-07-23 20:47:26 +0000 |
commit | 51072bd6bf79ef2bc6a922079bff57c31c1effbc (patch) | |
tree | 91a2effbc9e6f80bdbbf9eb70e06c51ad0867ea0 /test/std/atomics/atomics.flag/clear.pass.cpp | |
parent | bb5e33f003797b67974a8893f7f2930fc51b8210 (diff) |
Notes
Diffstat (limited to 'test/std/atomics/atomics.flag/clear.pass.cpp')
-rw-r--r-- | test/std/atomics/atomics.flag/clear.pass.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/test/std/atomics/atomics.flag/clear.pass.cpp b/test/std/atomics/atomics.flag/clear.pass.cpp index ea5ae45ae99a..255af8f176ea 100644 --- a/test/std/atomics/atomics.flag/clear.pass.cpp +++ b/test/std/atomics/atomics.flag/clear.pass.cpp @@ -22,50 +22,58 @@ int main() { { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; // uninitialized + f.clear(); + assert(f.test_and_set() == 0); f.clear(); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_relaxed); + assert(f.test_and_set() == 0); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_release); + assert(f.test_and_set() == 0); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - std::atomic_flag f(false); - f.test_and_set(); + std::atomic_flag f; + f.clear(std::memory_order_seq_cst); + assert(f.test_and_set() == 0); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(); + assert(f.test_and_set() == 0); f.clear(); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_relaxed); + assert(f.test_and_set() == 0); f.clear(std::memory_order_relaxed); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_release); + assert(f.test_and_set() == 0); f.clear(std::memory_order_release); assert(f.test_and_set() == 0); } { - volatile std::atomic_flag f(false); - f.test_and_set(); + volatile std::atomic_flag f; + f.clear(std::memory_order_seq_cst); + assert(f.test_and_set() == 0); f.clear(std::memory_order_seq_cst); assert(f.test_and_set() == 0); } |