| 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: test1.c |
| 8 | ** |
| 9 | ** Purpose: Tests iswspace with a range of wide characters. |
| 10 | ** |
| 11 | ** |
| 12 | ** |
| 13 | **==========================================================================*/ |
| 14 | |
| 15 | |
| 16 | |
| 17 | #include <palsuite.h> |
| 18 | |
| 19 | int __cdecl main(int argc, char *argv[]) |
| 20 | { |
| 21 | int ret; |
| 22 | int i; |
| 23 | |
| 24 | struct testChars |
| 25 | { |
| 26 | WCHAR charValue; |
| 27 | int result; |
| 28 | }; |
| 29 | |
| 30 | /* create an array of chars that test the range of possible characters */ |
| 31 | struct testChars testChars1[] = |
| 32 | { |
| 33 | {0x00,0}, /* null */ |
| 34 | {0x09,1}, /* open circle */ |
| 35 | {0x0D,1}, /* musical note */ |
| 36 | {0x20,1}, /* space */ |
| 37 | {0x3F,0}, /* ? */ |
| 38 | {0x5E,0}, /* ^ */ |
| 39 | {0x7B,0}, /* { */ |
| 40 | {0x86,0}, /* a with circle on top */ |
| 41 | {0x9F,0}, /* slanted f */ |
| 42 | {0xC4,0}, /* long dash */ |
| 43 | {0xE5,0} /* sigma */ |
| 44 | }; |
| 45 | |
| 46 | if (0 != PAL_Initialize(argc, argv)) |
| 47 | { |
| 48 | return FAIL; |
| 49 | } |
| 50 | |
| 51 | for (i = 0; i < (sizeof(testChars1) / sizeof(struct testChars)); i++) |
| 52 | { |
| 53 | |
| 54 | ret = iswspace(testChars1[i].charValue); |
| 55 | |
| 56 | if((ret==0) && (testChars1[i].result != 0)) |
| 57 | { |
| 58 | Fail("ERROR: wide character %#X IS considered a space, " |
| 59 | "but iswspace did NOT indicate it was one with error %u.\n" , |
| 60 | testChars1[i].charValue, |
| 61 | GetLastError()); |
| 62 | } |
| 63 | |
| 64 | if((ret!=0) && (testChars1[i].result == 0)) |
| 65 | { |
| 66 | Fail("ERROR: wide character %#X is NOT considered a space, " |
| 67 | "but iswspace DID indicate it was a space with error %u.\n" , |
| 68 | testChars1[i].charValue, |
| 69 | GetLastError()); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | |
| 74 | PAL_Terminate(); |
| 75 | |
| 76 | return PASS; |
| 77 | } |
| 78 | |
| 79 | |