diff mbox

[FFmpeg-devel] avutil/tests: improved code coverage for atomic

Message ID 1483245760-12302-1-git-send-email-thomastdt@googlemail.com
State Accepted
Commit b7a6d28e5e7ae4dff7c53a2f24e2017220dd6cc1
Headers show

Commit Message

Thomas Turner Jan. 1, 2017, 4:42 a.m. UTC
Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
---
 libavutil/tests/atomic.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 1, 2017, 3:16 p.m. UTC | #1
On Sat, Dec 31, 2016 at 08:42:40PM -0800, Thomas Turner wrote:
> Signed-off-by: Thomas Turner <thomastdt@googlemail.com>
> ---
>  libavutil/tests/atomic.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

applied

thx

[...]
diff mbox

Patch

diff --git a/libavutil/tests/atomic.c b/libavutil/tests/atomic.c
index c92f220..e41bf5a 100644
--- a/libavutil/tests/atomic.c
+++ b/libavutil/tests/atomic.c
@@ -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;
 }