mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
tests: Test g_atomic_pointer_compare_and_exchange() returning false
There were tests for the situation where it does the exchange and returns true, but no tests for the situation where it returns false. Signed-off-by: Philip Withnall <withnall@endlessm.com>
This commit is contained in:
parent
2eb3762241
commit
5dbaa18d61
@ -80,6 +80,9 @@ test_types (void)
|
||||
g_atomic_pointer_set (&vp, 0);
|
||||
vp2 = g_atomic_pointer_get (&vp);
|
||||
g_assert_true (vp2 == 0);
|
||||
res = g_atomic_pointer_compare_and_exchange (&vp, &s, &s);
|
||||
g_assert_false (res);
|
||||
g_assert_true (vp == 0);
|
||||
res = g_atomic_pointer_compare_and_exchange (&vp, 0, 0);
|
||||
g_assert_true (res);
|
||||
g_assert_true (vp == 0);
|
||||
@ -185,6 +188,9 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
g_atomic_pointer_set (&vp, 0);
|
||||
vp2 = g_atomic_pointer_get (&vp);
|
||||
g_assert_true (vp2 == 0);
|
||||
res = g_atomic_pointer_compare_and_exchange (&vp, &s, &s);
|
||||
g_assert_false (res);
|
||||
g_assert_true (vp == 0);
|
||||
res = g_atomic_pointer_compare_and_exchange (&vp, 0, 0);
|
||||
g_assert_true (res);
|
||||
g_assert_true (vp == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user