| 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: test2.c |
| 8 | ** |
| 9 | ** Purpose: Tests that GetCPInfo gives the correct information for codepage 0x4E4 |
| 10 | ** (the default). |
| 11 | ** |
| 12 | ** |
| 13 | **==========================================================================*/ |
| 14 | |
| 15 | |
| 16 | #include <palsuite.h> |
| 17 | |
| 18 | |
| 19 | int __cdecl main(int argc, char *argv[]) |
| 20 | { |
| 21 | CPINFO cpinfo; |
| 22 | int codepage; |
| 23 | unsigned int i; |
| 24 | |
| 25 | if (PAL_Initialize(argc, argv)) |
| 26 | { |
| 27 | return FAIL; |
| 28 | } |
| 29 | |
| 30 | /* |
| 31 | * codepage 1252 (0x4E4): Windows 3.1 Latin 1 (U.S., Western Europe) |
| 32 | */ |
| 33 | codepage = 1252; |
| 34 | |
| 35 | if (!GetCPInfo(codepage, &cpinfo)) |
| 36 | { |
| 37 | Fail("GetCPInfo() failed on default ansi code page!\n" ); |
| 38 | } |
| 39 | if (cpinfo.MaxCharSize != 1) |
| 40 | { |
| 41 | Fail("GetCPInfo() returned incorrect MaxCharSize information!\n" ); |
| 42 | } |
| 43 | if (cpinfo.DefaultChar[0] != '?' || cpinfo.DefaultChar[1] != 0) |
| 44 | { |
| 45 | Fail("GetCPInfo() returned incorrect DefaultChar information" ); |
| 46 | } |
| 47 | |
| 48 | for (i = 0; i<MAX_LEADBYTES; i++) |
| 49 | { |
| 50 | if (cpinfo.LeadByte[i] != 0) |
| 51 | { |
| 52 | Fail("GetCPInfo() returned incorrect LeadByte information" ); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | PAL_Terminate(); |
| 57 | |
| 58 | return PASS; |
| 59 | } |
| 60 | |
| 61 | |