zig/test/cases/atomics.zig
Andrew Kelley af536ac343 introduce new test syntax
* remove setFnTest builtin
 * add test "name" { ... } syntax
 * remove --check-unused argument. functions are always lazy now.
2017-03-16 16:02:35 -04:00

14 lines
278 B
Zig

const assert = @import("std").debug.assert;
test "cmpxchg" {
var x: i32 = 1234;
while (!@cmpxchg(&x, 1234, 5678, AtomicOrder.SeqCst, AtomicOrder.SeqCst)) {}
assert(x == 5678);
}
test "fence" {
var x: i32 = 1234;
@fence(AtomicOrder.SeqCst);
x = 5678;
}