[1/4] rpcrt4: Add encapsulated union tests

Dan Hipschman dsh at linux.ucla.edu
Mon Jun 18 20:36:14 CDT 2007


This adds the encapsulated union tests back in, which don't crash now.
Unfortunately, they don't pass yet, either.  However, the fix to get
it working is simple, and is included in my next three patches.  This
adds the tests with todo_wine around them.

---
 dlls/rpcrt4/tests/server.c         |   23 +++++++++++++++++++++++
 dlls/rpcrt4/tests/server.idl       |    8 ++++++++
 dlls/rpcrt4/tests/server_defines.h |    5 +++++
 3 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c
index aa5f3fc..44040df 100644
--- a/dlls/rpcrt4/tests/server.c
+++ b/dlls/rpcrt4/tests/server.c
@@ -245,6 +245,18 @@ s_square_test_us(test_us_t *tus)
   return n * n;
 }
 
+double
+s_square_encu(encu_t *eu)
+{
+  switch (eu->t)
+  {
+  case ENCU_I: return eu->tagged_union.i * eu->tagged_union.i;
+  case ENCU_F: return eu->tagged_union.f * eu->tagged_union.f;
+  default:
+    return 0.0;
+  }
+}
+
 void
 s_stop(void)
 {
@@ -363,6 +375,7 @@ basic_tests(void)
 static void
 union_tests(void)
 {
+  encu_t eu;
   sun_t su;
   int i;
 
@@ -382,6 +395,16 @@ union_tests(void)
   su.u.pi = &i;
   i = 11;
   ok(square_sun(&su) == 121.0, "RPC square_sun\n");
+
+todo_wine {
+  eu.t = ENCU_I;
+  eu.tagged_union.i = 7;
+  ok(square_encu(&eu) == 49.0, "RPC square_encu\n");
+
+  eu.t = ENCU_F;
+  eu.tagged_union.f = 3.0;
+  ok(square_encu(&eu) == 9.0, "RPC square_encu\n");
+}
 }
 
 static test_list_t *
diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl
index e3c3877..e7873f5 100644
--- a/dlls/rpcrt4/tests/server.idl
+++ b/dlls/rpcrt4/tests/server.idl
@@ -150,5 +150,13 @@ interface IServer
   } test_us_t;
 
   int square_test_us(test_us_t *tus);
+
+  typedef union encu switch (int t)
+  {
+  case ENCU_I: int i;
+  case ENCU_F: float f;
+  } encu_t;
+
+  double square_encu(encu_t *eu);
   void stop(void);
 }
diff --git a/dlls/rpcrt4/tests/server_defines.h b/dlls/rpcrt4/tests/server_defines.h
index 5794af2..5106e10 100644
--- a/dlls/rpcrt4/tests/server_defines.h
+++ b/dlls/rpcrt4/tests/server_defines.h
@@ -27,3 +27,8 @@
 /* test_list_t case values */
 #define TL_NULL 0
 #define TL_LIST 1
+
+/* encu_t case values */
+#define ENCU_I 27
+#define ENCU_F 0
+



More information about the wine-patches mailing list