| 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 that IsDBCSLeadByte does not find any lead-bytes in the |
| 10 | ** current ansi code page |
| 11 | ** |
| 12 | ** |
| 13 | ** TODO: Test for positive, i.e., if it is potentially isdbcsleadbyte |
| 14 | **==========================================================================*/ |
| 15 | |
| 16 | |
| 17 | #include <palsuite.h> |
| 18 | |
| 19 | void DoTest() |
| 20 | { |
| 21 | int value; |
| 22 | int ret; |
| 23 | int i; |
| 24 | |
| 25 | |
| 26 | for (i=0; i<256; i++) |
| 27 | { |
| 28 | value = IsDBCSLeadByte(i); |
| 29 | |
| 30 | ret = GetLastError(); |
| 31 | if (ret == ERROR_INVALID_PARAMETER) |
| 32 | { |
| 33 | Fail("IsDBCSLeadByte unexpectedly errored with ERROR_INVALID_PARAMETER for %d!\n" , i); |
| 34 | } |
| 35 | else if (ret != 0) |
| 36 | { |
| 37 | Fail("IsDBCSLeadByte had an unexpected error [%d] for %d!\n" , ret, i); |
| 38 | } |
| 39 | else if (value) |
| 40 | { |
| 41 | Fail("IsDBCSLeadByte incorrectly found a lead byte in value [%d] for" |
| 42 | " %d\n" , value, i); |
| 43 | } |
| 44 | |
| 45 | } |
| 46 | } |
| 47 | |
| 48 | int __cdecl main(int argc, char *argv[]) |
| 49 | { |
| 50 | |
| 51 | if (0 != PAL_Initialize(argc, argv)) |
| 52 | { |
| 53 | return FAIL; |
| 54 | } |
| 55 | |
| 56 | DoTest(); |
| 57 | |
| 58 | PAL_Terminate(); |
| 59 | |
| 60 | // setlocale( "japan", ); |
| 61 | |
| 62 | return PASS; |
| 63 | } |
| 64 | |
| 65 | |