[PATCH] msvcp120: Add tests for _Concurrent_vector_Internal_compact.

Hua Meng 161220092 at smail.nju.edu.cn
Wed Aug 15 08:59:42 CDT 2018


Signed-off-by: Hua meng <161220092 at smail.nju.edu.cn>
---
 dlls/msvcp120/tests/msvcp120.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index d7b82a3aae..77515cb27c 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -3095,6 +3095,29 @@ static void test_vector_base_v4(void)
     }
     for(; i<ARRAY_SIZE(b.blocks); i++)
         ok(!b.blocks[i], "b.blocks[%d] != NULL\n", i);
+    SET_EXPECT(concurrent_vector_int_alloc);
+    call_func4(p_vector_base_v4__Internal_reserve,
+            &v2, 17, sizeof(int), 32);
+    CHECK_CALLED(concurrent_vector_int_alloc);
+    data = call_func5(p_vector_base_v4__Internal_compact,
+            &v2, sizeof(int), &b, concurrent_vector_int_destroy,
+            concurrent_vector_int_copy);
+    ok(v2.first_block == 4, "v2.first_block got %ld expected 4\n", (long)v2.first_block);
+    ok(v2.early_size == 9, "v2.early_size got %ld expected 9\n", (long)v2.early_size);
+    ok(b.first_block == 4, "b.first_block got %ld expected 2\n", (long)b.first_block);
+    ok(v2.segment != v2.storage, "v2.segment got %p expected %p\n", v2.segment, v2.storage);
+    for(i = 4; i < 32; i++)
+        ok(v2.segment[i] == 0, "v2.segment[%d] got %p\n",
+                i, v2.segment[i]);
+    for(i=0; i<4; i++)
+        ok(!b.blocks[i], "b.blocks[%d] != NULL\n", i);
+    for(; i < 5; i++) {
+        ok(b.blocks[i] != NULL, "b.blocks[%d] got NULL\n", i);
+        free(b.blocks[i]);
+        vector_alloc_count--;
+    }
+    for(; i<ARRAY_SIZE(b.blocks); i++)
+        ok(!b.blocks[i], "b.blocks[%d] != NULL\n", i);
     SET_EXPECT(concurrent_vector_int_destroy);
     size = (size_t)call_func2(p_vector_base_v4__Internal_clear,
             &v2, concurrent_vector_int_destroy);
-- 
2.11.0






More information about the wine-devel mailing list