Sebastian Lackner : vcomp/tests: Add tests for atomic double functions.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jul 28 13:30:07 CDT 2015


Module: wine
Branch: master
Commit: dfe32d6c523f4e126be1a1c30806165af2bdea8d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=dfe32d6c523f4e126be1a1c30806165af2bdea8d

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Mon Jul 27 01:39:34 2015 +0200

vcomp/tests: Add tests for atomic double functions.

---

 dlls/vcomp/tests/vcomp.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 5be6965..f021a72 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -33,18 +33,22 @@ static VOID   (WINAPI *pReleaseActCtx)(HANDLE);
 
 static void  (CDECL   *p_vcomp_atomic_add_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_add_r4)(float *dest, float val);
+static void  (CDECL   *p_vcomp_atomic_add_r8)(double *dest, double val);
 static void  (CDECL   *p_vcomp_atomic_and_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_div_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_div_r4)(float *dest, float val);
+static void  (CDECL   *p_vcomp_atomic_div_r8)(double *dest, double val);
 static void  (CDECL   *p_vcomp_atomic_div_ui4)(unsigned int *dest, unsigned int val);
 static void  (CDECL   *p_vcomp_atomic_mul_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_mul_r4)(float *dest, float val);
+static void  (CDECL   *p_vcomp_atomic_mul_r8)(double *dest, double val);
 static void  (CDECL   *p_vcomp_atomic_or_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_shl_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_shr_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_shr_ui4)(unsigned int *dest, unsigned int val);
 static void  (CDECL   *p_vcomp_atomic_sub_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_atomic_sub_r4)(float *dest, float val);
+static void  (CDECL   *p_vcomp_atomic_sub_r8)(double *dest, double val);
 static void  (CDECL   *p_vcomp_atomic_xor_i4)(int *dest, int val);
 static void  (CDECL   *p_vcomp_barrier)(void);
 static void  (CDECL   *p_vcomp_for_static_end)(void);
@@ -192,18 +196,22 @@ static BOOL init_vcomp(void)
 
     VCOMP_GET_PROC(_vcomp_atomic_add_i4);
     VCOMP_GET_PROC(_vcomp_atomic_add_r4);
+    VCOMP_GET_PROC(_vcomp_atomic_add_r8);
     VCOMP_GET_PROC(_vcomp_atomic_and_i4);
     VCOMP_GET_PROC(_vcomp_atomic_div_i4);
     VCOMP_GET_PROC(_vcomp_atomic_div_r4);
+    VCOMP_GET_PROC(_vcomp_atomic_div_r8);
     VCOMP_GET_PROC(_vcomp_atomic_div_ui4);
     VCOMP_GET_PROC(_vcomp_atomic_mul_i4);
     VCOMP_GET_PROC(_vcomp_atomic_mul_r4);
+    VCOMP_GET_PROC(_vcomp_atomic_mul_r8);
     VCOMP_GET_PROC(_vcomp_atomic_or_i4);
     VCOMP_GET_PROC(_vcomp_atomic_shl_i4);
     VCOMP_GET_PROC(_vcomp_atomic_shr_i4);
     VCOMP_GET_PROC(_vcomp_atomic_shr_ui4);
     VCOMP_GET_PROC(_vcomp_atomic_sub_i4);
     VCOMP_GET_PROC(_vcomp_atomic_sub_r4);
+    VCOMP_GET_PROC(_vcomp_atomic_sub_r8);
     VCOMP_GET_PROC(_vcomp_atomic_xor_i4);
     VCOMP_GET_PROC(_vcomp_barrier);
     VCOMP_GET_PROC(_vcomp_for_static_end);
@@ -958,6 +966,31 @@ static void test_atomic_float(void)
     }
 }
 
+static void test_atomic_double(void)
+{
+    struct
+    {
+        void (CDECL *func)(double *, double);
+        double v1, v2, expected;
+    }
+    tests[] =
+    {
+        { p_vcomp_atomic_add_r8, 42.0, 17.0, 42.0 + 17.0 },
+        { p_vcomp_atomic_div_r8, 42.0, 17.0, 42.0 / 17.0 },
+        { p_vcomp_atomic_mul_r8, 42.0, 17.0, 42.0 * 17.0 },
+        { p_vcomp_atomic_sub_r8, 42.0, 17.0, 42.0 - 17.0 },
+    };
+    int i;
+
+    for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++)
+    {
+        double val = tests[i].v1;
+        tests[i].func(&val, tests[i].v2);
+        ok(tests[i].expected - 0.001 < val && val < tests[i].expected + 0.001,
+           "test %d: expected val == %f, got %f\n", i, tests[i].expected, val);
+    }
+}
+
 START_TEST(vcomp)
 {
     if (!init_vcomp())
@@ -971,6 +1004,7 @@ START_TEST(vcomp)
     test_vcomp_for_static_init();
     test_atomic_integer32();
     test_atomic_float();
+    test_atomic_double();
 
     release_vcomp();
 }




More information about the wine-cvs mailing list