wined3d: Move the fill mode to wined3d_rasterizer_state.
[wine.git] / dlls / wsdapi / tests / memory.c
blob9fb1a25476c198e55cdb813de16d7cafe1b0f861
1 /*
2 * Web Services on Devices
3 * Memory tests
5 * Copyright 2017 Owen Rudge for CodeWeavers
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define COBJMACROS
24 #include <windows.h>
26 #include "wine/test.h"
27 #include "wsdapi.h"
29 #define ALIGNMENT (2 * sizeof(void*))
30 #define NUM_ITERATIONS 100
32 static void AllocateLinkedMemory_tests(void)
34 void *alloc1;
35 void *alloc2;
36 void *alloc_ptrs[NUM_ITERATIONS];
37 int i;
39 /* Test a parentless allocation */
40 alloc1 = WSDAllocateLinkedMemory(NULL, 1024);
41 ok(alloc1 != NULL, "WSDAllocateLinkedMemory with null parent failed\n");
43 WSDFreeLinkedMemory(alloc1);
45 /* Test a parented allocation */
46 alloc1 = WSDAllocateLinkedMemory(NULL, 1024);
47 ok(alloc1 != NULL, "WSDAllocateLinkedMemory with null parent failed\n");
49 alloc2 = WSDAllocateLinkedMemory(alloc1, 1024);
50 ok(alloc2 != NULL, "WSDAllocateLinkedMemory with parent failed\n");
52 WSDFreeLinkedMemory(alloc1);
54 /* Try allocating against the freed parent */
55 alloc2 = WSDAllocateLinkedMemory(alloc1, 1024);
56 ok(alloc2 != NULL, "WSDAllocateLinkedMemory with parent failed\n");
58 /* Test that the returned pointers are aligned as expected */
59 for (i = 0; i < NUM_ITERATIONS; i++)
61 alloc_ptrs[i] = WSDAllocateLinkedMemory(NULL, i);
62 ok(((UINT_PTR)alloc_ptrs[i] % ALIGNMENT) == 0, "WSDAllocateLinkedMemory returned pointer not aligned (size = %d).\n", i);
65 for (i = 0; i < NUM_ITERATIONS; i++)
67 WSDFreeLinkedMemory(alloc_ptrs[i]);
71 START_TEST(memory)
73 AllocateLinkedMemory_tests();