skeleton for rpcrt4 test suite (RPC Merge A_PL4)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I have autoconf 2.53a, so I didn't include diffs against "configure", 
just "configure.ac".

LICENSE: X11

CHANGELOG:
* dlls/rpcrt4/tests/Makefile.in (new), dlls/rpcrt4/Makefile.in,
  dlls/rpcrt4/tests/rpc.c, configure.ac, dlls/rpcrt4/tests/.cvsignore: 
  Greg Turner <gmturner007@ameritech.net>
- added skeleton for rpcrt4 unit test with some UUID tests.

-- 
gmt

"If ye love wealth better than liberty, the tranquility
of servitude better than the animating contest of freedom,
go home from us in peace. We ask not your counsels or your
arms. Crouch down and lick the hands, which feed you. May
your chains set lightly upon you, and may posterity forget
that ye were our countrymen." 

-Samuel Adams
--- /dev/null	1969-12-31 18:00:00.000000000 -0600
+++ dlls/rpcrt4/tests/Makefile.in	2002-10-06 18:09:45.000000000 -0500
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = rpcrt4.dll
+IMPORTS   = rpcrt4
+
+CTESTS = \
+	rpc.c
+
+@MAKE_TEST_RULES@
+
+### Dependencies:
--- dlls/rpcrt4/Makefile.in.A_PL3	2002-10-07 09:13:53.000000000 -0500
+++ dlls/rpcrt4/Makefile.in	2002-10-06 17:59:31.000000000 -0500
@@ -13,6 +13,8 @@
         rpc_binding.c \
 	rpcrt4_main.c
 
+SUBDIRS = tests
+
 @MAKE_DLL_RULES@
 
 ### Dependencies:
--- configure.ac.A_PL3	2002-10-07 09:16:39.000000000 -0500
+++ configure.ac	2002-10-06 22:49:26.000000000 -0500
@@ -1435,6 +1435,7 @@
 dlls/rasapi32/Makefile
 dlls/richedit/Makefile
 dlls/rpcrt4/Makefile
+dlls/rpcrt4/tests/Makefile
 dlls/serialui/Makefile
 dlls/setupapi/Makefile
 dlls/shdocvw/Makefile
--- /dev/null	1969-12-31 18:00:00.000000000 -0600
+++ dlls/rpcrt4/tests/.cvsignore	2002-10-06 17:50:08.000000000 -0500
@@ -0,0 +1 @@
+rpc.ok
--- /dev/null	1969-12-31 18:00:00.000000000 -0600
+++ dlls/rpcrt4/tests/rpc.c	2002-10-07 01:07:28.000000000 -0500
@@ -0,0 +1,123 @@
+/*
+ * Unit test suite for rpc functions
+ *
+ * Copyright 2002 Greg Turner
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include "wine/test.h"
+#include <winbase.h>
+#include <winnt.h>
+#include <winerror.h>
+
+#include "wine/unicode.h"
+#include "rpc.h"
+
+UUID Uuid_Table[10] = {
+  { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 0 (null) */
+  { 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8a} }, /* 1 */
+  { 0xabadfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 2 */
+  { 0x93da375c, 0x1324, 0x1355, {0x87, 0xff, 0x49, 0x44, 0x34, 0x44, 0x22, 0x19} }, /* 3 */
+  { 0xdeadbeef, 0xdead, 0xbeef, {0x10, 0x21, 0x35, 0x56, 0x89, 0xa0, 0xf4, 0x8b} }, /* 4 (~1) */
+  { 0x9badfeed, 0x49ff, 0xbead, {0x8a, 0xf4, 0xa0, 0x89, 0x56, 0x35, 0x21, 0x10} }, /* 5 (~2) */
+  { 0x00000000, 0x0001, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} }, /* 6 (~0) */
+  { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01} }, /* 7 (~0) */
+  { 0x12312312, 0x1231, 0x1231, {0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff} }, /* 8 */
+  { 0x11111111, 0x1111, 0x1111, {0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11} }  /* 9 */
+};
+
+/* index of "10" means "NULL" */
+BOOL Uuid_Comparison_Grid[11][11] = {
+  { TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE  },
+  { FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE, FALSE },
+  { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE,  FALSE },
+  { TRUE,  FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE  }
+};
+
+void UuidConversionAndComparison(void) {
+    CHAR strx[100], x;
+    LPSTR str = strx;
+    WCHAR wstrx[100], wx;
+    LPWSTR wstr = wstrx;
+
+    UUID Uuid1, Uuid2, *PUuid1, *PUuid2;
+    RPC_STATUS rslt;
+
+    int i1,i2;
+
+    /* Uuid Equality */
+    for (i1 = 0; i1 < 11; i1++)
+        for (i2 = 0; i2 < 11; i2++) {
+	    if (i1 < 10) {
+	        Uuid1 = Uuid_Table[i1]; 
+		PUuid1 = &Uuid1;
+            } else {
+	        PUuid1 = NULL;
+	    }        
+	    if (i2 < 10) {
+	        Uuid2 = Uuid_Table[i2];
+		PUuid2 = &Uuid2;
+            } else {
+	        PUuid2 = NULL;
+	    }
+	    ok( (UuidEqual(PUuid1, PUuid2, &rslt) == Uuid_Comparison_Grid[i1][i2]), "UUID Equality" );
+        }
+
+    /* Uuid to String to Uuid (char) */
+    for (i1 = 0; i1 < 10; i1++) {
+        Uuid1 = Uuid_Table[i1];
+	ok( (UuidToStringA(&Uuid1, &str) == RPC_S_OK), "Simple UUID->String copy" );
+	ok( (UuidFromStringA(str, &Uuid2) == RPC_S_OK), "Simple String->UUID copy from generated UUID String" );
+	ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> String -> Uuid transform" );
+	/* invalid uuid tests  -- size of valid UUID string=36 */
+	for (i2 = 0; i2 < 36; i2++) {
+	    x = str[i2];
+	    str[i2] = 'g'; // whatever, but "g" is a good boundary condition
+	    ok( (UuidFromStringA(str, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID String" );
+	    str[i2] = x; // change it back so remaining tests are interesting.
+	}
+    }
+
+    /* Uuid to String to Uuid (wchar) */
+    for (i1 = 0; i1 < 10; i1++) {
+        Uuid1 = Uuid_Table[i1];
+	ok( (UuidToStringW(&Uuid1, &wstr) == RPC_S_OK), "Simple UUID->WString copy" );
+	ok( (UuidFromStringW(wstr, &Uuid2) == RPC_S_OK), "Simple WString->UUID copy from generated UUID String" );
+	ok( UuidEqual(&Uuid1, &Uuid2, &rslt), "Uuid -> WString -> Uuid transform" );
+	/* invalid uuid tests  -- size of valid UUID string=36 */
+	for (i2 = 0; i2 < 36; i2++) {
+	    x = wstr[i2];
+	    wstr[i2] = 'g'; // whatever, but "g" is a good boundary condition
+	    ok( (UuidFromStringA(wstr, &Uuid1) == RPC_S_INVALID_STRING_UUID), "Invalid UUID WString" );
+	    wstr[i2] = x; // change it back so remaining tests are interesting.
+	}
+    }
+}
+
+START_TEST( rpc )
+{
+    trace ( " **** STARTING RPC TESTS ****\n" );
+    trace ( " ** Uuid Conversion and Comparison Tests **\n" );
+    UuidConversionAndComparison();
+    trace ( " **** END RPC TESTS ****\n");
+}
--- dlls/rpcrt4/rpc_binding.c.A_PL3	2002-10-04 11:24:38.000000000 -0500
+++ dlls/rpcrt4/rpc_binding.c	2002-10-06 23:06:30.000000000 -0500
@@ -1,7 +1,7 @@
 /*
  * RPC binding API
  *
- * Copyright 2001 Ove K�en, TransGaming Technologies
+ * Copyright 2001 Ove Kåven, TransGaming Technologies
  *
  * TODO:
  *  - a whole lot

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux