>From 155e9e6fac99497d423ed333277b6ca94585b23f Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Fri, 13 Oct 2017 17:07:55 +0200 Subject: [PATCH] msvcp60: runtime_error name test To: wine-patches --- dlls/msvcp60/tests/string.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/dlls/msvcp60/tests/string.c b/dlls/msvcp60/tests/string.c index f61ad4af9a..1a46e0bec6 100644 --- a/dlls/msvcp60/tests/string.c +++ b/dlls/msvcp60/tests/string.c @@ -43,6 +43,19 @@ typedef struct MSVCP_size_t res; } basic_string_wchar; +typedef void (*vtable_ptr)(void); +typedef struct __exception +{ + const vtable_ptr *vtable; + char *name; + int do_free; +} exception; + +typedef struct { + exception e; + basic_string_char str; +} runtime_error; + static basic_string_char* (__cdecl *p_basic_string_char_concatenate)(basic_string_char*, const basic_string_char*, const basic_string_char*); static basic_string_char* (__cdecl *p_basic_string_char_concatenate_cstr)(basic_string_char*, const basic_string_char*, const char*); @@ -86,6 +99,9 @@ static size_t (__thiscall *p_basic_string_wchar_size)(basic_string_wchar*); static size_t (__thiscall *p_basic_string_wchar_capacity)(basic_string_wchar*); static void (__thiscall *p_basic_string_wchar_swap)(basic_string_wchar*, basic_string_wchar*); +static runtime_error* (__thiscall *p_runtime_error_ctor_bstr)(runtime_error*, const basic_string_char*); +static void (__thiscall *p_runtime_error_dtor)(runtime_error*); + /* Emulate a __thiscall */ #ifdef __i386__ @@ -226,6 +242,11 @@ static BOOL init(void) "?capacity@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEBA_KXZ"); SET(p_basic_string_wchar_swap, "?swap@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QEAAXAEAV12@@Z"); + + SET(p_runtime_error_ctor_bstr, + "??0runtime_error@std@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z"); + SET(p_runtime_error_dtor, + "??1runtime_error@std@@UEAA@XZ"); } else { SET(p_basic_string_char_ctor, "??_F?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXXZ"); @@ -292,6 +313,11 @@ static BOOL init(void) "?capacity@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QBEIXZ"); SET(p_basic_string_wchar_swap, "?swap@?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@QAEXAAV12@@Z"); + + SET(p_runtime_error_ctor_bstr, + "??0runtime_error@std@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z"); + SET(p_runtime_error_dtor, + "??1runtime_error@std@@UAE@XZ"); } init_thiscall_thunk(); @@ -687,6 +713,23 @@ static void test_basic_string_wchar_swap(void) { call_func1(p_basic_string_wchar_dtor, &str2); } +static void test_runtime_error(void) +{ + basic_string_char str; + runtime_error re; + + call_func3(p_basic_string_char_ctor_cstr_alloc, &str, "test", &fake_allocator); + + memset(&re, 0xff, sizeof(re)); + call_func2(p_runtime_error_ctor_bstr, &re, &str); + ok(re.e.name != NULL, "re.e.name == NULL\n"); + ok(!re.e.name[0], "re.e.name = %s\n", re.e.name); + ok(re.e.do_free, "re.e.do_free == FALSE\n"); + + call_func1(p_runtime_error_dtor, &re); + call_func1(p_basic_string_char_dtor, &str); +} + START_TEST(string) { if(!init()) @@ -703,5 +746,7 @@ START_TEST(string) test_basic_string_wchar(); test_basic_string_wchar_swap(); + test_runtime_error(); + FreeLibrary(msvcp); } -- 2.13.6