1/*
2 * Copyright (c) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16#include <wchar.h>
17#include <stdio.h>
18#include <string.h>
19#include <locale.h>
20#include <bits/alltypes.h>
21#include "test.h"
22
23/**
24 * @tc.name      : wcscasecmp_l_0100
25 * @tc.desc      : Test wcscasecmp_l compare case-ignoring wide strings
26 * @tc.level     : Level 0
27 */
28void wcscasecmp_l_0100(void)
29{
30    locale_t local_info = NULL;
31    int result = wcscasecmp_l(L"hello", L"HELLO", local_info);
32    if (result != 0) {
33        t_error("%s wcscasecmp_l get result is %d are not 0\n", __func__, result);
34    }
35}
36
37/**
38 * @tc.name      : wcscasecmp_l_0200
39 * @tc.desc      : Test the result of calling wcscasecmp_l with uppercase letters, plus numbers, and lowercase letters
40 *                 and small numbers
41 * @tc.level     : Level 1
42 */
43void wcscasecmp_l_0200(void)
44{
45    locale_t local_info = NULL;
46    int result = wcscasecmp_l(L"hello1", L"HELLO2", local_info);
47    if (result >= 0) {
48        t_error("%s wcscasecmp_l get result is %d are more then 0\n", __func__, result);
49    }
50}
51
52/**
53 * @tc.name      : wcscasecmp_l_0300
54 * @tc.desc      : Test the result of calling wcscasecmp_l with uppercase letters plus small numbers and lowercase
55 *                 letters and large numbers
56 * @tc.level     : Level 1
57 */
58void wcscasecmp_l_0300(void)
59{
60    locale_t local_info = NULL;
61    int result = wcscasecmp_l(L"hello2", L"HELLO1", local_info);
62    if (result <= 0) {
63        t_error("%s wcscasecmp_l get result is %d are less then 0\n", __func__, result);
64    }
65}
66
67/**
68 * @tc.name      : wcscasecmp_l_0400
69 * @tc.desc      : Test the result of calling wcscasecmp_l for shorter uppercase wide strings versus longer lowercase
70 *                 wide strings
71 * @tc.level     : Level 1
72 */
73void wcscasecmp_l_0400(void)
74{
75    locale_t local_info = NULL;
76    int result = wcscasecmp_l(L"hello", L"HELL", local_info);
77    if (result <= 0) {
78        t_error("%s wcscasecmp_l get result is %d are less then 0\n", __func__, result);
79    }
80}
81
82/**
83 * @tc.name      : wcscasecmp_l_0500
84 * @tc.desc      : Test the result of calling wcscasecmp_l on a shorter lowercase wide string versus a longer uppercase
85 *                 wide string
86 * @tc.level     : Level 1
87 */
88void wcscasecmp_l_0500(void)
89{
90    locale_t local_info = NULL;
91    int result = wcscasecmp_l(L"hell", L"HELLO", local_info);
92    if (result >= 0) {
93        t_error("%s wcscasecmp_l get result is %d are more then 0\n", __func__, result);
94    }
95}
96
97int main(int argc, char *argv[])
98{
99    wcscasecmp_l_0100();
100    wcscasecmp_l_0200();
101    wcscasecmp_l_0300();
102    wcscasecmp_l_0400();
103    wcscasecmp_l_0500();
104    return t_status;
105}