diff options
author | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 16:48:50 +0200 |
---|---|---|
committer | Vasilis Kalintiris <ehostunreach@gmail.com> | 2013-12-07 19:36:01 +0200 |
commit | 66db5a1d3ed9055ff58a2d249c18b55f7fd677df (patch) | |
tree | bd842905a6c7bd52390973761c4ddf6d23069a66 /tests/core | |
parent | 70884fb056b4d862fc0038cdcb4a742e5d13aa94 (diff) |
Use do_run_from_file() for test_atomic
Diffstat (limited to 'tests/core')
-rw-r--r-- | tests/core/test_atomic.in | 20 | ||||
-rw-r--r-- | tests/core/test_atomic.out | 5 |
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/core/test_atomic.in b/tests/core/test_atomic.in new file mode 100644 index 00000000..d0950551 --- /dev/null +++ b/tests/core/test_atomic.in @@ -0,0 +1,20 @@ + + #include <stdio.h> + int main() { + int x = 10; + int y = __sync_add_and_fetch(&x, 5); + printf("*%d,%d*\n", x, y); + x = 10; + y = __sync_fetch_and_add(&x, 5); + printf("*%d,%d*\n", x, y); + x = 10; + y = __sync_lock_test_and_set(&x, 6); + printf("*%d,%d*\n", x, y); + x = 10; + y = __sync_bool_compare_and_swap(&x, 9, 7); + printf("*%d,%d*\n", x, y); + y = __sync_bool_compare_and_swap(&x, 10, 7); + printf("*%d,%d*\n", x, y); + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_atomic.out b/tests/core/test_atomic.out new file mode 100644 index 00000000..ed11bce0 --- /dev/null +++ b/tests/core/test_atomic.out @@ -0,0 +1,5 @@ +*15,15* +*15,10* +*6,10* +*10,0* +*7,1*
\ No newline at end of file |