Hua Meng : msvcp120: Add test for Concurrent_vector_grow_by.
Module: wine Branch: master Commit: 6ea1c9da6315843db56599c90adadf01d7052ae0 URL: https://source.winehq.org/git/wine.git/?a=commit;h=6ea1c9da6315843db56599c90... Author: Hua Meng <161220092(a)smail.nju.edu.cn> Date: Tue Jun 26 18:35:39 2018 +0800 msvcp120: Add test for Concurrent_vector_grow_by. Signed-off-by: Hua Meng <161220092(a)smail.nju.edu.cn> Signed-off-by: Piotr Caban <piotr(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/msvcp120/tests/msvcp120.c | 46 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c index 0ec9fbd..b5e470c 100644 --- a/dlls/msvcp120/tests/msvcp120.c +++ b/dlls/msvcp120/tests/msvcp120.c @@ -418,6 +418,8 @@ static void (__thiscall *p_vector_base_v4__Internal_swap)( static void* (__thiscall *p_vector_base_v4__Internal_compact)( vector_base_v4*, size_t, void*, void (__cdecl*)(void*, size_t), void (__cdecl*)(void*, const void*, size_t)); +static size_t (__thiscall *p_vector_base_v4__Internal_grow_by)( + vector_base_v4*, size_t, size_t, void (__cdecl*)(void*, const void*, size_t), const void *); static HMODULE msvcp; #define SETNOFAIL(x,y) x = (void*)GetProcAddress(msvcp,y) @@ -568,6 +570,8 @@ static BOOL init(void) "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAXAEAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAAPEAX_KPEAXP6AX10(a)ZP6AX1PEBX0@Z(a)Z"); + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IEAA_K_K0P6AXPEAXPEBX0(a)Z2@Z"); } else { SET(p_tr2_sys__File_size, "?_File_size(a)sys@tr2(a)std@@YA_KPBD(a)Z"); @@ -687,6 +691,8 @@ static BOOL init(void) "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEXAAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEPAXIPAXP6AX0I(a)ZP6AX0PBXI@Z(a)Z"); + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAEIIIP6AXPAXPBXI(a)Z1@Z"); #else SET(p__Thrd_current, "_Thrd_current"); @@ -734,7 +740,8 @@ static BOOL init(void) "?_Internal_swap(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAXAAV123@@Z"); SET(p_vector_base_v4__Internal_compact, "?_Internal_compact(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAPAXIPAXP6AX0I(a)ZP6AX0PBXI@Z(a)Z"); - + SET(p_vector_base_v4__Internal_grow_by, + "?_Internal_grow_by(a)_Concurrent_vector_base_v4@details(a)Concurrency@@IAAIIIP6AXPAXPBXI(a)Z1@Z"); #endif } SET(p__Thrd_equal, @@ -2992,6 +2999,43 @@ static void test_vector_base_v4(void) CHECK_CALLED(concurrent_vector_int_destroy); concurrent_vector_int_dtor(&v2); + /* test for Internal_grow_by */ + concurrent_vector_int_ctor(&v2); + SET_EXPECT(concurrent_vector_int_alloc); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + CHECK_CALLED(concurrent_vector_int_alloc); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + data = call_func3(p_vector_base_v4__Internal_push_back, &v2, sizeof(int), &idx); + ok(data != NULL, "_Internal_push_back returned NULL\n"); + vector_elem_count += 2; + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 2, "v2.early_size got %ld expected 2\n", (long)v2.early_size); + i = 0; + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_by, + &v2, 1, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 2, "_Internal_grow_by returned %ld expected 2\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 3, "v2.early_size got %ld expected 3\n", (long)v2.early_size); + SET_EXPECT(concurrent_vector_int_alloc); + SET_EXPECT(concurrent_vector_int_copy); + idx = (size_t)call_func5(p_vector_base_v4__Internal_grow_by, + &v2, 2, sizeof(int), concurrent_vector_int_copy, &i); + CHECK_CALLED(concurrent_vector_int_alloc); + CHECK_CALLED(concurrent_vector_int_copy); + ok(idx == 3, "_Internal_grow_by returned %ld expected 3\n", (long)idx); + ok(v2.first_block == 1, "v2.first_block got %ld expected 1\n", (long)v2.first_block); + ok(v2.early_size == 5, "v2.early_size got %ld expected 5\n", (long)v2.early_size); + SET_EXPECT(concurrent_vector_int_destroy); + size = (size_t)call_func2(p_vector_base_v4__Internal_clear, + &v2, concurrent_vector_int_destroy); + ok(size == 3, "_Internal_clear returned %ld expected 3\n", (long)size); + CHECK_CALLED(concurrent_vector_int_destroy); + concurrent_vector_int_dtor(&v2); + SET_EXPECT(concurrent_vector_int_destroy); size = (size_t)call_func2(p_vector_base_v4__Internal_clear, &vector, concurrent_vector_int_destroy);
participants (1)
-
Alexandre Julliard