Module: wine Branch: master Commit: 08c846a9da942656f2f463154e141e91f03f1112 URL: http://source.winehq.org/git/wine.git/?a=commit;h=08c846a9da942656f2f463154e...
Author: Dan Hipschman dsh@linux.ucla.edu Date: Mon Jun 18 18:36:14 2007 -0700
rpcrt4: Add encapsulated union tests.
---
dlls/rpcrt4/tests/server.c | 23 +++++++++++++++++++++++ dlls/rpcrt4/tests/server.idl | 8 ++++++++ dlls/rpcrt4/tests/server_defines.h | 4 ++++ 3 files changed, 35 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..51f934f 100644 --- a/dlls/rpcrt4/tests/server_defines.h +++ b/dlls/rpcrt4/tests/server_defines.h @@ -27,3 +27,7 @@ /* 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