1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | |
5 | /*============================================================ |
6 | ** |
7 | ** Source : test.c |
8 | ** |
9 | ** Purpose: Test for GetLastError() function |
10 | ** |
11 | ** |
12 | **=========================================================*/ |
13 | |
14 | /* Depends on SetLastError() */ |
15 | |
16 | #include <palsuite.h> |
17 | |
18 | /** |
19 | * Helper functions that does the actual test |
20 | */ |
21 | static void test(DWORD error ) |
22 | { |
23 | DWORD TheResult; |
24 | |
25 | /* Set error */ |
26 | SetLastError(error); |
27 | |
28 | /* Check to make sure it returns the error value we just set */ |
29 | TheResult = GetLastError(); |
30 | if(TheResult!= error) |
31 | { |
32 | Fail("ERROR: The last error should have been %u, but when " |
33 | "GetLastError was called, it returned %u.\n" ,error,TheResult); |
34 | } |
35 | |
36 | } |
37 | |
38 | int __cdecl main(int argc, char *argv[]) { |
39 | |
40 | |
41 | /* |
42 | * Initialize the PAL and return FAILURE if this fails |
43 | */ |
44 | |
45 | if(0 != (PAL_Initialize(argc, argv))) |
46 | { |
47 | return FAIL; |
48 | } |
49 | |
50 | /* test setting and getting some values */ |
51 | test(5); |
52 | test(0xffffffff); |
53 | test(0xEEEEEEEE); |
54 | test(0xAAAAAAAA); |
55 | |
56 | PAL_Terminate(); |
57 | return PASS; |
58 | } |
59 | |
60 | |
61 | |
62 | |
63 | |
64 | |