source: trunk/src/win32k/test/DosAllocMemEx.c@ 10367

Last change on this file since 10367 was 5186, checked in by bird, 25 years ago

Added a test to verify grow theory.

File size: 3.2 KB
Line 
1/* $Id: DosAllocMemEx.c,v 1.2 2001-02-19 05:58:18 bird Exp $
2 *
3 * Testcases for DosAllocMemEx.
4 *
5 * Copyright (c) 2001 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
6 *
7 * Project Odin Software License can be found in LICENSE.TXT
8 *
9 */
10
11
12
13/*******************************************************************************
14* Defined Constants And Macros *
15*******************************************************************************/
16#define TESTCASES 10
17
18#define INCL_BASE
19
20
21/*******************************************************************************
22* Header Files *
23*******************************************************************************/
24#include <os2.h>
25
26#include <stdio.h>
27#include <string.h>
28
29#include "win32k.h"
30
31
32
33
34
35int main(argc, argv)
36int argc;
37char **argv;
38{
39 struct Tests
40 {
41 APIRET rc;
42 ULONG cb;
43 PVOID pv;
44 ULONG fl;
45 } aTests[] =
46 {
47 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_WRITE | PAG_COMMIT},
48 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT},
49 { 0, 0x00001000, 0x00230000, PAG_READ | PAG_COMMIT | OBJ_ALIGN64K | OBJ_LOCATION},
50 { 0, 0x00001000, 0x03f30000, PAG_READ | PAG_COMMIT | OBJ_ALIGN64K | OBJ_LOCATION},
51 { 0, 0x00001000, 0x04030000, PAG_READ | PAG_COMMIT | OBJ_ALIGN64K | OBJ_LOCATION},
52 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGNPAGE},
53 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY},
54 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K},
55 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K},
56 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K},
57 { 0, 0x00001000, 0x00000000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K},
58 { 0, 0x00001000, 0x31230000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K | OBJ_LOCATION},
59 { 0, 0x00001000, 0x23030000, PAG_READ | PAG_COMMIT | OBJ_ANY | OBJ_ALIGN64K | OBJ_LOCATION},
60 };
61
62 int i;
63 int cErrors;
64 APIRET rc;
65 PVOID pv;
66
67 /*
68 * Init win32k.sys library.
69 */
70 rc = libWin32kInit();
71 if (rc != NO_ERROR)
72 {
73 printf("failed to init win32k.sys. rc=%d\n", rc);
74 return rc;
75 }
76
77
78 /*
79 * Execute the tests.
80 * xx: 0x00000000 0x00000000 0x00000000 00000 0000000 0x00000000
81 */
82 printf("no. Size pv(in) flags rc(in) rc(out) pv(out)\n"
83 "-----------------------------------------------------------\n");
84 for (i = 0, cErrors = 0; i < sizeof(aTests) / sizeof(aTests[0]); i++)
85 {
86 printf("%2d: 0x%08x 0x%08x 0x%08x %5d ",
87 i, aTests[i].cb, aTests[i].pv, aTests[i].fl, aTests[i].rc);
88 pv = aTests[i].pv;
89 rc = DosAllocMemEx(&pv, aTests[i].cb, aTests[i].fl);
90 printf("%7d 0x%08x\n", rc, pv);
91
92 /* evaluate result */
93 cErrors += (rc != aTests[i].rc || (pv != aTests[i].pv && aTests[i].pv != NULL));
94 }
95
96 printf("Done %d tests, %d failed\n", i, cErrors);
97 libWin32kTerm();
98
99 return cErrors;
100}
101
Note: See TracBrowser for help on using the repository browser.