]> git.sesse.net Git - ffmpeg/commitdiff
avutil/tests: improved code coverage for atomic
authorThomas Turner <thomastdt@googlemail.com>
Sun, 1 Jan 2017 04:42:40 +0000 (20:42 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 1 Jan 2017 15:57:55 +0000 (16:57 +0100)
Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavutil/tests/atomic.c

index c92f220a7aa7d54bf5f52ae09f0ce5634a22dc5d..e41bf5a2b94cdac07723a5ab794124df12b38d16 100644 (file)
@@ -21,7 +21,9 @@
 
 int main(void)
 {
-    volatile int val = 1;
+    volatile int val      = 1;
+    void *tmp1            = (int *)&val;
+    void * volatile *tmp2 = &tmp1;
     int res;
 
     res = avpriv_atomic_int_add_and_fetch(&val, 1);
@@ -29,6 +31,8 @@ int main(void)
     avpriv_atomic_int_set(&val, 3);
     res = avpriv_atomic_int_get(&val);
     av_assert0(res == 3);
+    avpriv_atomic_ptr_cas(tmp2, tmp1, &res);
+    av_assert0(*tmp2 == &res);
 
     return 0;
 }