Piotr Caban : ucrtbase: Add initial __std_type_info tests.
Alexandre Julliard
julliard at winehq.org
Thu Aug 4 17:20:18 CDT 2016
Module: wine
Branch: master
Commit: f45db432ce1bc9e26f386278a73ed98760e6de25
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f45db432ce1bc9e26f386278a73ed98760e6de25
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Aug 4 16:29:06 2016 +0200
ucrtbase: Add initial __std_type_info tests.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ucrtbase/tests/cpp.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/dlls/ucrtbase/tests/cpp.c b/dlls/ucrtbase/tests/cpp.c
index 12b0422..168cd21 100644
--- a/dlls/ucrtbase/tests/cpp.c
+++ b/dlls/ucrtbase/tests/cpp.c
@@ -33,8 +33,25 @@ typedef struct {
MSVCRT_bool dofree;
} __std_exception_data;
+typedef struct
+{
+ char *name;
+ char mangled[32];
+} type_info140;
+
+typedef struct _type_info_list
+{
+ SLIST_ENTRY entry;
+ char name[1];
+} type_info_list;
+
+static void* (CDECL *p_malloc)(size_t);
static void (CDECL *p___std_exception_copy)(const __std_exception_data*, __std_exception_data*);
static void (CDECL *p___std_exception_destroy)(__std_exception_data*);
+static int (CDECL *p___std_type_info_compare)(const type_info140*, const type_info140*);
+static const char* (CDECL *p___std_type_info_name)(type_info140*, SLIST_HEADER*);
+static void (CDECL *p___std_type_info_destroy_list)(SLIST_HEADER*);
+
static BOOL init(void)
{
@@ -47,8 +64,12 @@ static BOOL init(void)
return FALSE;
}
+ p_malloc = (void*)GetProcAddress(module, "malloc");
p___std_exception_copy = (void*)GetProcAddress(module, "__std_exception_copy");
p___std_exception_destroy = (void*)GetProcAddress(module, "__std_exception_destroy");
+ p___std_type_info_compare = (void*)GetProcAddress(module, "__std_type_info_compare");
+ p___std_type_info_name = (void*)GetProcAddress(module, "__std_type_info_name");
+ p___std_type_info_destroy_list = (void*)GetProcAddress(module, "__std_type_info_destroy_list");
return TRUE;
}
@@ -96,8 +117,48 @@ static void test___std_exception(void)
ok(!dst.dofree, "dst.dofree != FALSE\n");
}
+static void test___std_type_info(void)
+{
+ type_info140 ti1 = { NULL, ".?AVa@@" };
+ type_info140 ti2 = { NULL, ".?AVb@@" };
+ type_info140 ti3 = ti1;
+ SLIST_HEADER header;
+ type_info_list *elem;
+ const char *ret;
+ int eq;
+
+
+ InitializeSListHead(&header);
+ p___std_type_info_destroy_list(&header);
+
+ elem = p_malloc(sizeof(*elem));
+ memset(elem, 0, sizeof(*elem));
+ InterlockedPushEntrySList(&header, &elem->entry);
+ p___std_type_info_destroy_list(&header);
+ ok(!InterlockedPopEntrySList(&header), "list is not empty\n");
+
+ ret = p___std_type_info_name(&ti1, &header);
+ ok(!strcmp(ret, "class a"), "__std_type_info_name(&ti1) = %s\n", ret);
+ ok(ti1.name == ret, "ti1.name = %p, ret = %p\n", ti1.name, ret);
+
+ p___std_type_info_destroy_list(&header);
+ ok(!InterlockedPopEntrySList(&header), "list is not empty\n");
+ ok(ti1.name == ret, "ti1.name = %p, ret = %p\n", ti1.name, ret);
+ ti1.name = NULL;
+
+ eq = p___std_type_info_compare(&ti1, &ti1);
+ ok(eq == 0, "__std_type_info_compare(&ti1, &ti1) = %d\n", eq);
+
+ eq = p___std_type_info_compare(&ti1, &ti2);
+ ok(eq == -1, "__std_type_info_compare(&ti1, &ti2) = %d\n", eq);
+
+ eq = p___std_type_info_compare(&ti1, &ti3);
+ ok(eq == 0, "__std_type_info_compare(&ti1, &ti3) = %d\n", eq);
+}
+
START_TEST(cpp)
{
if (!init()) return;
test___std_exception();
+ test___std_type_info();
}
More information about the wine-cvs
mailing list