[PATCH v11 4/8] wdscore/tests: Add CurrentIP test.

Mohamad Al-Jaf mohamadaljaf at gmail.com
Mon Apr 11 22:01:30 CDT 2022


Signed-off-by: Mohamad Al-Jaf <mohamadaljaf at gmail.com>
---
v10: - Remove redundant headers.

Hopefully this was the reason why it wasn't getting committed.
---
 configure.ac                   |  1 +
 dlls/wdscore/tests/Makefile.in |  4 +++
 dlls/wdscore/tests/main.c      | 59 ++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)
 create mode 100644 dlls/wdscore/tests/Makefile.in
 create mode 100644 dlls/wdscore/tests/main.c

diff --git a/configure.ac b/configure.ac
index 6cbc0a61be1..48445cc7b2f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3072,6 +3072,7 @@ WINE_CONFIG_MAKEFILE(dlls/wbemdisp/tests)
 WINE_CONFIG_MAKEFILE(dlls/wbemprox)
 WINE_CONFIG_MAKEFILE(dlls/wbemprox/tests)
 WINE_CONFIG_MAKEFILE(dlls/wdscore)
+WINE_CONFIG_MAKEFILE(dlls/wdscore/tests)
 WINE_CONFIG_MAKEFILE(dlls/webservices)
 WINE_CONFIG_MAKEFILE(dlls/webservices/tests)
 WINE_CONFIG_MAKEFILE(dlls/websocket)
diff --git a/dlls/wdscore/tests/Makefile.in b/dlls/wdscore/tests/Makefile.in
new file mode 100644
index 00000000000..baf4adf23a1
--- /dev/null
+++ b/dlls/wdscore/tests/Makefile.in
@@ -0,0 +1,4 @@
+TESTDLL   = wdscore.dll
+
+C_SRCS = \
+	main.c
diff --git a/dlls/wdscore/tests/main.c b/dlls/wdscore/tests/main.c
new file mode 100644
index 00000000000..f1f8c6d27ae
--- /dev/null
+++ b/dlls/wdscore/tests/main.c
@@ -0,0 +1,59 @@
+/*
+ * Unit test suite for wdscore
+ *
+ * Copyright 2022 Mohamad Al-Jaf
+ *
+ * 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 "wine/test.h"
+
+static HMODULE dll;
+static LPVOID (*pCurrentIP)(void);
+
+static BOOL init_function_pointers(void)
+{
+    dll = LoadLibraryA("wdscore.dll");
+
+    if (dll)
+    {
+        pCurrentIP = (void*)GetProcAddress(dll, "CurrentIP");
+        return TRUE;
+    }
+    return FALSE;
+}
+
+static void test_CurrentIP(void)
+{
+    char *cur;
+    char *ret;
+
+    cur = (char*)&test_CurrentIP;
+    ret = (char*)pCurrentIP();
+
+    ok(cur <= ret && ret < (cur + 0x100), "Address %p not in function starting at %p.\n", ret, cur);
+}
+
+START_TEST(main)
+{
+    if (init_function_pointers())
+    {
+        test_CurrentIP();
+        FreeLibrary(dll);
+    }
+    else
+        skip("could not load wdscore.dll\n");
+}
-- 
2.35.1




More information about the wine-devel mailing list