summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/test1.cpp
blob: ad326be08406b3afa8e421c85bf91b6e0916afac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

/*============================================================================
**
** Source: test1.c
**
** Purpose: Tests that IsDBCSLeadByte does not find any lead-bytes in the
**          current ansi code page 
**
**
** TODO: Test for positive, i.e., if it is potentially isdbcsleadbyte
**==========================================================================*/


#include <palsuite.h>

void DoTest()
{
    int value;
    int ret;
    int i;


    for (i=0; i<256; i++)
    {
        value = IsDBCSLeadByte(i);

        ret = GetLastError();
        if (ret == ERROR_INVALID_PARAMETER)
        {
            Fail("IsDBCSLeadByte unexpectedly errored with ERROR_INVALID_PARAMETER for %d!\n", i);
        }
        else if (ret != 0)
        {
            Fail("IsDBCSLeadByte had an unexpected error [%d] for %d!\n", ret, i);
        }
        else if (value)
        {
            Fail("IsDBCSLeadByte incorrectly found a lead byte in value [%d] for"
                " %d\n", value, i);
        }

    }
}

int __cdecl main(int argc, char *argv[])
{

    if (0 != PAL_Initialize(argc, argv))
    {
        return FAIL;
    }

    DoTest();

    PAL_Terminate();

//    setlocale( "japan", );

    return PASS;
}