On Tue, Jun 24, 2008 at 4:55 PM, Austin English <[EMAIL PROTECTED]> wrote:
> On Tue, Jun 24, 2008 at 3:55 PM, James Hawkins <[EMAIL PROTECTED]> wrote:
>> On Tue, Jun 24, 2008 at 3:47 PM, Austin English <[EMAIL PROTECTED]> wrote:
>>>
>>
>> Changes like these are so simple that you really should go the extra 5
>> feet and write simple tests for them.
>>
>> --
>> James Hawkins
>>
>
> I have little C/programming experience. I was simply taking the patch
> mentioned in bug 2642 <http://bugs.winehq.org/show_bug.cgi?id=2642>,
> rediffing it against HEAD and submitting it. Looking at the
> function/MSDN/other testcases, it shouldn't be too rough to write one,
> I'll see if I can't hack one together.
>
> -Austin
>

I tried hacking a bit of a testcase together, but my lack of
programming skills has led me to a dead end. If someone wants to pick
it up from here, or send comments on what's wrong, it's attached.
Currently, fails to compile:

[EMAIL PROTECTED]:~/wine-git/dlls/rasapi32/tests$ make crosstest
i586-mingw32msvc-gcc -c -I. -I. -I../../../include -I../../../include
 -D_REENTRANT -fPIC -Wall -pipe -fno-strict-aliasing
-Wdeclaration-after-statement -Wwrite-strings -Wpointer-arith  -g -O2
-o rasapi.cross.o rasapi.c
rasapi.c:1: warning: -fPIC ignored for target (all code is position independent)
rasapi.c: In function `test_rasenum':
rasapi.c:36: error: syntax error before '=' token
rasapi.c:38: error: syntax error before "LPRASDEVINFOA"
rasapi.c:39: warning: implicit declaration of function `ok'
rasapi.c:42: error: syntax error before "LPDWORD"
rasapi.c:34: warning: unused variable `i'
rasapi.c: At top level:
rasapi.c:48: warning: return type defaults to `int'
make: *** [rasapi.cross.o] Error 1
From 482dbed6de576c4388d46ded4b17c5bcd6dcb3f4 Mon Sep 17 00:00:00 2001
From: Austin English <[EMAIL PROTECTED]>
Date: Tue, 24 Jun 2008 17:02:47 -0500
Subject: [PATCH] rasapi32: add initial tests

---
 .gitignore                      |    3 ++
 Makefile.in                     |    2 +
 configure                       |    3 ++
 configure.ac                    |    1 +
 dlls/Makefile.in                |    1 +
 dlls/rasapi32/tests/Makefile.in |   13 ++++++++++
 dlls/rasapi32/tests/rasapi.c    |   49 +++++++++++++++++++++++++++++++++++++++
 programs/winetest/Makefile.in   |    3 ++
 programs/winetest/winetest.rc   |    1 +
 9 files changed, 76 insertions(+), 0 deletions(-)
 create mode 100644 dlls/rasapi32/tests/Makefile.in
 create mode 100644 dlls/rasapi32/tests/rasapi.c

diff --git a/.gitignore b/.gitignore
index d546c2e..55550f0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -339,6 +339,8 @@ dlls/quartz/tests/testlist.c
 dlls/rasapi16.dll16
 dlls/rasapi32/librasapi32.def
 dlls/resutils/libresutils.def
+dlls/rasapi32/tests/*.ok
+dlls/rasapi32/tests/rasapi32_crosstest.exe
 dlls/riched20/libriched20.def
 dlls/riched20/tests/*.ok
 dlls/riched20/tests/riched20_crosstest.exe
@@ -676,6 +678,7 @@ programs/winetest/psapi_test.exe
 programs/winetest/qedit_test.exe
 programs/winetest/qmgr_test.exe
 programs/winetest/quartz_test.exe
+programs/winetest/rasapi32_test.exe
 programs/winetest/riched20_test.exe
 programs/winetest/riched32_test.exe
 programs/winetest/rpcrt4_test.exe
diff --git a/Makefile.in b/Makefile.in
index f2dbcfc..8209c95 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -407,6 +407,7 @@ ALL_MAKEFILES = \
        dlls/quartz/tests/Makefile \
        dlls/query/Makefile \
        dlls/rasapi32/Makefile \
+       dlls/rasapi32/tests/Makefile \
        dlls/resutils/Makefile \
        dlls/riched20/Makefile \
        dlls/riched20/tests/Makefile \
@@ -835,6 +836,7 @@ dlls/quartz/Makefile: dlls/quartz/Makefile.in 
dlls/Makedll.rules
 dlls/quartz/tests/Makefile: dlls/quartz/tests/Makefile.in dlls/Maketest.rules
 dlls/query/Makefile: dlls/query/Makefile.in dlls/Makedll.rules
 dlls/rasapi32/Makefile: dlls/rasapi32/Makefile.in dlls/Makedll.rules
+dlls/rasapi32/tests/Makefile: dlls/rasapi32/tests/Makefile.in 
dlls/Maketest.rules
 dlls/resutils/Makefile: dlls/resutils/Makefile.in dlls/Makedll.rules
 dlls/riched20/Makefile: dlls/riched20/Makefile.in dlls/Makedll.rules
 dlls/riched20/tests/Makefile: dlls/riched20/tests/Makefile.in 
dlls/Maketest.rules
diff --git a/configure b/configure
index e855076..63b953a 100755
--- a/configure
+++ b/configure
@@ -22012,6 +22012,8 @@ ac_config_files="$ac_config_files dlls/query/Makefile"
 
 ac_config_files="$ac_config_files dlls/rasapi32/Makefile"
 
+ac_config_files="$ac_config_files dlls/rasapi32/tests/Makefile"
+
 ac_config_files="$ac_config_files dlls/resutils/Makefile"
 
 ac_config_files="$ac_config_files dlls/riched20/Makefile"
@@ -23163,6 +23165,7 @@ do
     "dlls/quartz/tests/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/quartz/tests/Makefile" ;;
     "dlls/query/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/query/Makefile" ;;
     "dlls/rasapi32/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/rasapi32/Makefile" ;;
+    "dlls/rasapi32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/rasapi32/tests/Makefile" ;;
     "dlls/resutils/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/resutils/Makefile" ;;
     "dlls/riched20/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/riched20/Makefile" ;;
     "dlls/riched20/tests/Makefile") CONFIG_FILES="$CONFIG_FILES 
dlls/riched20/tests/Makefile" ;;
diff --git a/configure.ac b/configure.ac
index 77287de..87ab373 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1919,6 +1919,7 @@ AC_CONFIG_FILES([dlls/quartz/Makefile])
 AC_CONFIG_FILES([dlls/quartz/tests/Makefile])
 AC_CONFIG_FILES([dlls/query/Makefile])
 AC_CONFIG_FILES([dlls/rasapi32/Makefile])
+AC_CONFIG_FILES([dlls/rasapi32/tests/Makefile])
 AC_CONFIG_FILES([dlls/resutils/Makefile])
 AC_CONFIG_FILES([dlls/riched20/Makefile])
 AC_CONFIG_FILES([dlls/riched20/tests/Makefile])
diff --git a/dlls/Makefile.in b/dlls/Makefile.in
index 9470561..65bb83b 100644
--- a/dlls/Makefile.in
+++ b/dlls/Makefile.in
@@ -342,6 +342,7 @@ TESTSUBDIRS = \
        qedit/tests \
        qmgr/tests \
        quartz/tests \
+       rasapi32/tests \
        riched20/tests \
        riched32/tests \
        rpcrt4/tests \
diff --git a/dlls/rasapi32/tests/Makefile.in b/dlls/rasapi32/tests/Makefile.in
new file mode 100644
index 0000000..c6f079a
--- /dev/null
+++ b/dlls/rasapi32/tests/Makefile.in
@@ -0,0 +1,13 @@
+TOPSRCDIR = @top_srcdir@
+TOPOBJDIR = ../../..
+SRCDIR    = @srcdir@
+VPATH     = @srcdir@
+TESTDLL   = rasapi32.dll
+IMPORTS   = kernel32
+
+CTESTS = \
+       rasapi.c
+
[EMAIL PROTECTED]@
+
[EMAIL PROTECTED]@  # everything below this line is overwritten by make depend
diff --git a/dlls/rasapi32/tests/rasapi.c b/dlls/rasapi32/tests/rasapi.c
new file mode 100644
index 0000000..ca6a56a
--- /dev/null
+++ b/dlls/rasapi32/tests/rasapi.c
@@ -0,0 +1,49 @@
+/*
+* Unit test suite for rasapi functions
+*
+* Copyright 2008 Austin English
+*
+* 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+*/
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <windef.h>
+#include <winbase.h>
+#include <wine/debug.h>
+#include <windows.h>
+#include "ras.h"
+#include "raserror.h"
+
+static void test_rasenum(void)
+{
+
+BOOL result;
+
+       LPRASDEVINFO = sizeof(RASDEVINFO);
+
+       result = RasEnumDevicesA(LPRASDEVINFOA, NULL, LPDWORD lpcDevices);
+       ok(!result && (GetLastError() == ERROR_INVALID_PARAMETER),
+       "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
+
+       result = RasEnumDevicesA(NULL, LPDWORD lpcb, LPDWORD lpcDevices);
+       ok(!result && (GetLastError() == ERROR_INVALID_PARAMETER),
+       "Expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
+}
+
+START_TEST(rasapi)
+{
+    test_rasenum();
+}
diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in
index 89e0f5d..9431466 100644
--- a/programs/winetest/Makefile.in
+++ b/programs/winetest/Makefile.in
@@ -81,6 +81,7 @@ TESTBINS = \
        qedit_test.exe \
        qmgr_test.exe \
        quartz_test.exe \
+       rasapi32_test.exe \
        riched20_test.exe \
        riched32_test.exe \
        rpcrt4_test.exe \
@@ -220,6 +221,8 @@ qmgr_test.exe: $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT)
        cp $(DLLDIR)/qmgr/tests/qmgr_test.exe$(DLLEXT) $@ && $(STRIP) $@
 quartz_test.exe: $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT)
        cp $(DLLDIR)/quartz/tests/quartz_test.exe$(DLLEXT) $@ && $(STRIP) $@
+rasapi32_test.exe: $(DLLDIR)/rasapi32/tests/rasapi32_test.exe$(DLLEXT)
+       cp $(DLLDIR)/rasapi32/tests/rasapi32_test.exe$(DLLEXT) $@ && $(STRIP) $@
 riched20_test.exe: $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT)
        cp $(DLLDIR)/riched20/tests/riched20_test.exe$(DLLEXT) $@ && $(STRIP) $@
 riched32_test.exe: $(DLLDIR)/riched32/tests/riched32_test.exe$(DLLEXT)
diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc
index 5c78c8f..8a293a8 100644
--- a/programs/winetest/winetest.rc
+++ b/programs/winetest/winetest.rc
@@ -142,6 +142,7 @@ psapi_test.exe TESTRES "psapi_test.exe"
 qedit_test.exe TESTRES "qedit_test.exe"
 qmgr_test.exe TESTRES "qmgr_test.exe"
 quartz_test.exe TESTRES "quartz_test.exe"
+rasapi32_test.exe TESTRES "rasapi32_test.exe"
 riched20_test.exe TESTRES "riched20_test.exe"
 riched32_test.exe TESTRES "riched32_test.exe"
 rpcrt4_test.exe TESTRES "rpcrt4_test.exe"
-- 
1.5.3.6



Reply via email to