mirror of
https://github.com/ziglang/zig.git
synced 2024-11-30 09:02:32 +00:00
af536ac343
* remove setFnTest builtin * add test "name" { ... } syntax * remove --check-unused argument. functions are always lazy now.
14 lines
278 B
Zig
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;
|
|
}
|