summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2013-01-12 23:55:52 +0400
committerIvan Maidanski <ivmai@mail.ru>2013-01-12 23:55:52 +0400
commit07ada9bb18fdee939cb7d1add4d5bfa11a6c4d09 (patch)
tree712e7f78e82dcce1e709cc00e33635d1f9acedc9 /tests
parente492ca21390f1d32916991c43a0407860dd672a2 (diff)
downloadlibatomic_ops-07ada9bb18fdee939cb7d1add4d5bfa11a6c4d09.tar.gz
Add AO_double_store pthread-based implementation and tests
* src/atomic_ops/sysdeps/generic_pthread.h (AO_double_store_full): New primitive. * tests/test_atomic_include.template (test_atomicXX): Add test of AO_double_storeXX.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_atomic_include.template21
1 files changed, 20 insertions, 1 deletions
diff --git a/tests/test_atomic_include.template b/tests/test_atomic_include.template
index ea6fd9d..60068b5 100644
--- a/tests/test_atomic_include.template
+++ b/tests/test_atomic_include.template
@@ -26,7 +26,8 @@ void test_atomicXX(void)
AO_TS_t z = AO_TS_INITIALIZER;
# endif
# if defined(AO_HAVE_double_compare_and_swapXX) \
- || defined(AO_HAVE_double_loadXX)
+ || defined(AO_HAVE_double_loadXX) \
+ || defined(AO_HAVE_double_storeXX)
AO_double_t old_w;
AO_double_t new_w;
# endif
@@ -254,6 +255,24 @@ void test_atomicXX(void)
|| !defined(AO_HAVE_double_load_read)
MISSING(AO_double_load);
# endif
+# if defined(AO_HAVE_double_storeXX)
+ new_w.AO_val1 = 1375;
+ new_w.AO_val2 = 8243;
+ AO_double_storeXX(&old_w, new_w);
+ TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243);
+ AO_double_storeXX(&old_w, new_w);
+ TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243);
+ new_w.AO_val1 ^= old_w.AO_val1;
+ new_w.AO_val2 ^= old_w.AO_val2;
+ AO_double_storeXX(&old_w, new_w);
+ TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0);
+# elif !defined(AO_HAVE_double_store) \
+ || !defined(AO_HAVE_double_store_full) \
+ || !defined(AO_HAVE_double_store_release) \
+ || !defined(AO_HAVE_double_store_release_write) \
+ || !defined(AO_HAVE_double_store_write)
+ MISSING(AO_double_store);
+# endif
# if defined(AO_HAVE_compare_double_and_swap_doubleXX)
TA_assert(!AO_compare_double_and_swap_doubleXX(&w, 17, 42, 12, 13));
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);