mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ucrtbase: Add initial __std_type_info tests.
Signed-off-by: Piotr Caban <piotr@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
4ba09e11a8
commit
f45db432ce
1 changed files with 61 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue