• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 <stdarg.h>
17 
18 #include <wchar.h>
19 
20 #include "IoTest.h"
21 #include <securec.h>
22 
23 using namespace testing::ext;
24 
25 
FormatVfwscanf(FILE * fp,const wchar_t * format,...)26 int FormatVfwscanf(FILE *fp, const wchar_t *format, ...)
27 {
28     va_list args;
29     va_start(args, format);
30     int ret = vfwscanf(fp, format, args);
31     va_end(args);
32     return ret;
33 }
34 
FormatVfwprintf(FILE * fp,const wchar_t * format,...)35 int FormatVfwprintf(FILE *fp, const wchar_t *format, ...)
36 {
37     va_list args;
38     va_start(args, format);
39     int ret = vfwprintf(fp, format, args);
40     va_end(args);
41     return ret;
42 }
43 
44 /**
45  * @tc.number SUB_KERNEL_IO_WCHAR_0100
46  * @tc.name   vfwprintf basic function test
47  * @tc.desc   [C- SOFTWARE -0200]
48  */
49 HWTEST_F(IoTest, testVfwprintf, Function | MediumTest | Level1)
50 {
51     FILE *fp = nullptr;
52     FOPEN_WRITE(fp);
53     int ret = FormatVfwprintf(fp, L"%s has %d words ", "helloworld", 10);
54     EXPECT_EQ(ret, 24);
55     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
56 
57     FOPEN_READ(fp);
58     wchar_t wStr[50] = {0};
59     int i;
60     ret = FormatVfwscanf(fp, L"%ls has %d words ", wStr, &i);
61     EXPECT_EQ(ret, 2) << "> vfwscanf return fail, errno = " << errno;
62     EXPECT_STREQ(wStr, L"helloworld");
63     EXPECT_EQ(i, 10);
64 
65     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
66 }
67 
68 /**
69  * @tc.number SUB_KERNEL_IO_WCHAR_0200
70  * @tc.name   fwprintf basic function test
71  * @tc.desc   [C- SOFTWARE -0200]
72  */
73 HWTEST_F(IoTest, testFwprintf, Function | MediumTest | Level1)
74 {
75     FILE *fp = nullptr;
76     FOPEN_WRITE(fp);
77     int ret = fwprintf(fp, L"%s has %d words ", "helloworld", 10);
78     EXPECT_EQ(ret, 24);
79     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
80 
81     FOPEN_READ(fp);
82     wchar_t wStr[50] = {0};
83     int i;
84     ret = fwscanf(fp, L"%ls has %d words ", wStr, &i);
85     EXPECT_EQ(ret, 2) << "> vfwscanf return fail, errno = " << errno;
86     EXPECT_STREQ(wStr, L"helloworld");
87     EXPECT_EQ(i, 10);
88 
89     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
90 }
91 
92 /**
93  * @tc.number SUB_KERNEL_IO_WCHAR_0300
94  * @tc.name   fwide basic function test
95  * @tc.desc   [C- SOFTWARE -0200]
96  */
97 HWTEST_F(IoTest, testFwide, Function | MediumTest | Level1)
98 {
99     FILE *fp = nullptr;
100     INIT_TEST_FILE(fp);
101     FOPEN_READ(fp);
102     int ret = fwide(fp, -6);
103     EXPECT_EQ(ret, -1);
104     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
105 
106     FOPEN_READ(fp);
107     ret = fwide(fp, 0);
108     EXPECT_EQ(ret, 0);
109     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
110 
111     FOPEN_READ(fp);
112     ret = fwide(fp, 8);
113     EXPECT_EQ(ret, 1);
114     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
115 }
116 
117 /**
118  * @tc.number SUB_KERNEL_IO_WCHAR_0400
119  * @tc.name   fgetws basic function test
120  * @tc.desc   [C- SOFTWARE -0200]
121  */
122 HWTEST_F(IoTest, testFgetws, Function | MediumTest | Level1)
123 {
124     FILE *fp = nullptr;
125     FOPEN_WRITE(fp);
126     wchar_t wStr[50] = {0};
127     wchar_t wStrT[50] = L"hello world";
128     int ret = fputws(wStrT, fp);
129     ASSERT_NE(ret, -1) << "> fputws fail, errno = " << errno;
130     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
131 
132     FOPEN_READ(fp);
133     wchar_t *retW = fgetws(wStr, sizeof(wStr)/sizeof(wStr[0]), fp);
134     EXPECT_STREQ(retW, wStrT);
135     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
136 }
137 
138 /**
139  * @tc.number SUB_KERNEL_IO_WCHAR_0500
140  * @tc.name   putwc basic function test
141  * @tc.desc   [C- SOFTWARE -0200]
142  */
143 HWTEST_F(IoTest, testPutwc, Function | MediumTest | Level1)
144 {
145     FILE *fp = nullptr;
146     FOPEN_WRITE(fp);
147     wint_t ret = putwc(L'A', fp);
148     EXPECT_EQ(ret, L'A');
149     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
150 
151     FOPEN_READ(fp);
152     ret = getwc(fp);
153     EXPECT_EQ(ret, L'A');
154     EXPECT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
155 }
156 
157 /**
158  * @tc.number SUB_KERNEL_IO_WCHAR_0600
159  * @tc.name   ungetwc basic function test
160  * @tc.desc   [C- SOFTWAret -0200]
161  */
162 HWTEST_F(IoTest, testUngetwc, Function | MediumTest | Level1)
163 {
164     FILE *fp = nullptr;
165     INIT_TEST_FILE(fp);
166     FOPEN_READ(fp);
167     wint_t ret = getwc(fp);
168     EXPECT_EQ(ret, 104U);
169     ret = ungetc(ret, fp);
170     EXPECT_EQ(ret, 104U);
171     wchar_t str[50] = {0};
172     wchar_t *retS = fgetws(str, sizeof(str)/sizeof(str[0]), fp);
173     EXPECT_STREQ(retS, str);
174     EXPECT_STREQ(str, L"hello world");
175     EXPECT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
176 }
177 
178 /**
179  * @tc.number SUB_KERNEL_IO_WCHAR_0700
180  * @tc.name   fputwc basic function test
181  * @tc.desc   [C- SOFTWARE -0200]
182  */
183 HWTEST_F(IoTest, testFputwc, Function | MediumTest | Level1)
184 {
185     FILE *fp = nullptr;
186     FOPEN_WRITE(fp);
187     wint_t ret = fputwc(L'A', fp);
188     EXPECT_EQ(ret, L'A');
189     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
190 
191     FOPEN_READ(fp);
192     ret = fgetwc(fp);
193     EXPECT_EQ(ret, L'A');
194     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = " << errno;
195 }
196 
197 /**
198  * @tc.number SUB_KERNEL_IO_WCHAR_0800
199  * @tc.name   fwscanf basic function test
200  * @tc.desc   [C- SOFTWARE -0200]
201  */
202 HWTEST_F(IoTest, testFwscanf, Function | MediumTest | Level1)
203 {
204     FILE *fp = nullptr;
205     FOPEN_WRITE(fp);
206     int ret = fwprintf(fp, L"%ls has %d words", L"helloworld", 10);
207     EXPECT_EQ(ret, 23);
208     EXPECT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
209 
210     FOPEN_READ(fp);
211     wchar_t wStr[50] = {0};
212     int i;
213     ret = fwscanf(fp, L"%ls has %d words", wStr, &i);
214     EXPECT_EQ(ret, 2);
215     EXPECT_EQ(i, 10);
216     EXPECT_STREQ(wStr, L"helloworld");
217     ASSERT_NE(fclose(fp), -1) << "> fclose fail, errno = "<< errno;
218 }
219 
220 /**
221  * @tc.number SUB_KERNEL_IO_WCHAR_0900
222  * @tc.name   wmemset  basic function test
223  * @tc.desc   [C- SOFTWARE -0200]
224  */
225 HWTEST_F(IoTest, testWmemset, Function | MediumTest | Level1)
226 {
227     wchar_t dest[50] = {0};
228     wchar_t *ret = wmemset(dest, L'=', 8);
229     EXPECT_STREQ(ret, dest);
230     EXPECT_STREQ(dest, L"========");
231 
232     ret = wmemset(dest, L' ', 8);
233     EXPECT_STREQ(ret, dest);
234     EXPECT_STREQ(dest, L"        ");
235 
236     ret = wmemset(dest, L'!', 0);
237     EXPECT_STREQ(ret, dest);
238     EXPECT_STREQ(dest, L"        ");
239 }
240 
241 /**
242  * @tc.number SUB_KERNEL_IO_WCHAR_1000
243  * @tc.name   wmemchr basic function test
244  * @tc.desc   [C- SOFTWARE -0200]
245  */
246 HWTEST_F(IoTest, testWmemchr, Function | MediumTest | Level1)
247 {
248     wchar_t src[] = L"hello world";
249     wchar_t *ret = wmemchr(src, L' ', sizeof(src)/sizeof(src[0]) - 1);
250     EXPECT_STREQ(ret, L" world");
251 
252     wchar_t srcT[] = L"this is string";
253     ret = wmemchr(srcT, L'?', sizeof(srcT)/sizeof(srcT[0]) - 1);
254     EXPECT_STREQ(ret, nullptr);
255 }
256 
257 /**
258  * @tc.number SUB_KERNEL_IO_WCHAR_1100
259  * @tc.name   wmemcpy basic function test
260  * @tc.desc   [C- SOFTWARE -0200]
261  */
262 HWTEST_F(IoTest, testWmemcpy, Function | MediumTest | Level1)
263 {
264     wchar_t src[] = L"hello";
265     wchar_t dest[] = L"world ! ! !";
266     wchar_t *ret = wmemcpy(dest, src, 5);
267     EXPECT_STREQ(ret, L"hello ! ! !");
268 
269     wchar_t srcT[] = L"this is";
270     wchar_t destT[] = L"string";
271     ret = wmemcpy(destT, srcT, 0);
272     EXPECT_STREQ(ret, destT);
273 }
274 
275 /**
276  * @tc.number SUB_KERNEL_IO_WCHAR_1200
277  * @tc.name   wmemmove basic function test
278  * @tc.desc   [C- SOFTWARE -0200]
279  */
280 HWTEST_F(IoTest, testWmemmove, Function | MediumTest | Level1)
281 {
282     wchar_t src[] = L"hello";
283     wchar_t dest[] = L"world ! ! !";
284     wchar_t *ret = wmemmove(dest, src, 5);
285     EXPECT_STREQ(ret, L"hello ! ! !");
286 
287     wchar_t srcT[] = L"this is";
288     wchar_t destT[] = L"string";
289     ret = wmemmove(destT, srcT, 0);
290     EXPECT_STREQ(ret, destT);
291 }
292 
293 /**
294  * @tc.number SUB_KERNEL_IO_WCHAR_1300
295  * @tc.name   putwchar basic function test
296  * @tc.desc   [C- SOFTWARE -0200]
297  */
298 HWTEST_F(IoTest, testPutwchar, Function | MediumTest | Level1)
299 {
300     for (wchar_t wc = L'A'; wc <= L'Z'; ++wc) {
301         wint_t ret = putwchar(wc);
302         EXPECT_EQ(ret, wc);
303     }
304 }
305 
306 /**
307  * @tc.number SUB_KERNEL_IO_WCHAR_1400
308  * @tc.name   wmemcmp basic function test
309  * @tc.desc   [C- SOFTWARE -0200]
310  */
311 HWTEST_F(IoTest, testWmemcmp, Function | MediumTest | Level1)
312 {
313     wchar_t dest[] = L"BBCDEFG";
314     wchar_t src[] = L"CBCDEFF";
315     int ret = wmemcmp(dest, src, 7);
316     EXPECT_LT(ret, 0);
317 
318     ret = wmemcmp(L"abcdefg", L"ABCDEFG", 2);
319     EXPECT_GT(ret, 0);
320 
321     ret = wmemcmp(L"ABCDEFG", L"ABCDEFG", 6);
322     EXPECT_EQ(ret, 0);
323 }
324 
325 /**
326  * @tc.number SUB_KERNEL_IO_WCHAR_1500
327  * @tc.name   mbsinit basic function test
328  * @tc.desc   [C- SOFTWARE -0200]
329  */
330 HWTEST_F(IoTest, testMbsinit, Function | MediumTest | Level1)
331 {
332     mbstate_t *ps = nullptr;
333     int ret = mbsinit(ps);
334     int memRet = -1;
335     EXPECT_NE(ret, 0);
336 
337     mbstate_t psF;
338     memRet = memset_s(&psF, sizeof(psF), 0, sizeof(psF));
339     EXPECT_EQ(0, memRet);
340     ret = mbsinit(&psF);
341     EXPECT_NE(ret, 0);
342 }
343 
FormatVswscanf(const wchar_t * str,const wchar_t * format,...)344 int FormatVswscanf(const wchar_t *str, const wchar_t *format, ...)
345 {
346     va_list args;
347     va_start(args, format);
348     int ret = vswscanf(str, format, args);
349     va_end(args);
350     return ret;
351 }
352 
FormatVswprintf(const wchar_t * format,...)353 int FormatVswprintf(const wchar_t *format, ...)
354 {
355     va_list args;
356     va_start(args, format);
357     wchar_t str[50] = {0};
358     int ret = vswprintf(str, sizeof(str)/sizeof(str[0]), format, args);
359     fputws(str, stdout);
360     va_end(args);
361     return ret;
362 }
363 
364 /**
365  * @tc.number SUB_KERNEL_IO_WCHAR_1600
366  * @tc.name   vswprintf basic function test
367  * @tc.desc   [C- SOFTWARE -0200]
368  */
369 HWTEST_F(IoTest, testVswprintf, Function | MediumTest | Level1)
370 {
371     int ret = FormatVswprintf(L"%ls has %d words", L"helloworld", 10);
372     EXPECT_EQ(ret, 23);
373 
374     int i;
375     wchar_t wBuf[50] = {0};
376     wchar_t str[] = L"helloworld has 10 words";
377     ret = FormatVswscanf(str, L"%ls has %d words", wBuf, &i);
378     EXPECT_EQ(ret, 2) << "> vswcanf return fail, errno = " << errno;
379     EXPECT_STREQ(wBuf, L"helloworld");
380     EXPECT_EQ(i, 10);
381 }
382 
383 /**
384  * @tc.number SUB_KERNEL_IO_WCHAR_1700
385  * @tc.name   swprintf basic function test
386  * @tc.desc   [C- SOFTWARE -0200]
387  */
388 HWTEST_F(IoTest, testSwprintf, Function | MediumTest | Level1)
389 {
390     wchar_t wBuf[50] = {0};
391     int ret = swprintf(wBuf, sizeof(wBuf)/sizeof(wBuf[0]), L"%ls has %d words", L"helloworld", 10);
392     EXPECT_EQ(ret, 23);
393     EXPECT_STREQ(wBuf, L"helloworld has 10 words");
394 
395     wchar_t wStr[50] = {0};
396     int i;
397     ret = swscanf(wBuf, L"%ls has %d words", wStr, &i);
398     EXPECT_EQ(ret, 2) << "> swscanf return fail, errno = " << errno;
399     EXPECT_EQ(i, 10);
400     EXPECT_STREQ(wStr, L"helloworld");
401 }
402 
403 /**
404  * @tc.number SUB_KERNEL_IO_WCHAR_1800
405  * @tc.name   wprintf basic function test
406  * @tc.desc   [C- SOFTWARE -0200]
407  */
408 HWTEST_F(IoTest, testWprintf, Function | MediumTest | Level1)
409 {
410     pid_t pid = fork();
411     ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
412     if (pid == 0) { // child
413         int rt = 0;
414         FILE *fp = freopen(IOTEST_TEMPFILE, "w", stdout);
415         if (fp == nullptr) {
416             LOG("freopen fail, errno = %d", errno);
417             rt = 1;
418         }
419         if (wprintf(L"%ls %d", L"helloworld", 10) != 13) {
420             LOG("wprintf fail, errno = %d", errno);
421             rt = 1;
422         }
423         if (fclose(fp) == -1) {
424             LOG("fclose fail, errno = %d", errno);
425             rt = 1;
426         }
427         exit(rt);
428     } else { // parent
429         WaitProcExitedOK(pid);
430 
431         FILE *fp1 = fopen(IOTEST_TEMPFILE, "r");
432         ASSERT_NE(fp1, nullptr) << "fopen fail, errno = " << errno;
433         wchar_t str[50] = {0};
434         wchar_t *gStr = fgetws(str, sizeof(str)/sizeof(str[0]), fp1);
435         EXPECT_STREQ(gStr, str) << "fgetws fail, errno = " << errno;
436         EXPECT_STREQ(str, L"helloworld 10") << "fgetws fail, errno = " << errno;
437         EXPECT_NE(fclose(fp1), -1) << "> fclose fail, errno = " << errno;
438     }
439 }
440 
441 /**
442  * @tc.number SUB_KERNEL_IO_WCHAR_1900
443  * @tc.name   wscanf basic function test
444  * @tc.desc   [C- SOFTWARE -0200]
445  */
446 HWTEST_F(IoTest, testWscanf, Function | MediumTest | Level1)
447 {
448     FILE  *fp = nullptr;
449     INIT_TEST_FILE(fp);
450     pid_t pid = fork();
451     ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
452     if (pid == 0) { // child
453         int rt = 0;
454         FILE *fp1 = freopen(IOTEST_TEMPFILE, "r", stdin);
455         if (fp1 == nullptr) {
456             LOG("freopen fail, errno = %d", errno);
457             rt = 1;
458         }
459         wchar_t str[50] = {0};
460         if (wscanf(L"%ls", str) != 1) {
461             LOG("wscanf fail, errno = %d", errno);
462             rt = 1;
463             if (wcscmp(str, L"hello world") != 0) {
464                 LOG("wscanf fail, errno = %d", errno);
465                 rt = 1;
466             }
467         }
468         if (fclose(fp1) == -1) {
469             LOG("fclose  fail, errno = %d", errno);
470         }
471         exit(rt);
472     } else { // parent
473         WaitProcExitedOK(pid);
474     }
475 }
476 
FormatVwprintf(const wchar_t * format,...)477 int FormatVwprintf(const wchar_t *format, ...)
478 {
479     va_list argPtr;
480     va_start(argPtr, format);
481     int ret = vwprintf(format, argPtr);
482     va_end(argPtr);
483     return ret;
484 }
485 
486 /**
487  * @tc.number SUB_KERNEL_IO_WCHAR_2000
488  * @tc.name   vwprintf basic function test
489  * @tc.desc   [C- SOFTWARE -0200]
490  */
491 HWTEST_F(IoTest, testVwprintf, Function | MediumTest | Level1)
492 {
493     pid_t pid = fork();
494     ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
495     if (pid == 0) { // child
496         int rt = 0;
497         FILE *fp = freopen(IOTEST_TEMPFILE, "w", stdout);
498         if (fp == nullptr) {
499             LOG("freopen fail, errno = %d", errno);
500             rt = 1;
501         }
502         if (FormatVwprintf(L"%ls %d", L"helloworld", 10) != 13) {
503             LOG("vwprintf fail, errno = %d", errno);
504             rt = 1;
505         }
506         if (fclose(fp) == -1) {
507             LOG("fclose fail, errno = %d", errno);
508             rt = 1;
509         }
510         exit(rt);
511     } else { // parent
512         WaitProcExitedOK(pid);
513 
514         FILE *fp1 = fopen(IOTEST_TEMPFILE, "r");
515         ASSERT_NE(fp1, nullptr) << "fopen fail, errno = " << errno;
516         wchar_t str[50] = {0};
517         wchar_t *gStr = fgetws(str, sizeof(str)/sizeof(str[0]), fp1);
518         EXPECT_STREQ(gStr, str) << "fgetws fail, errno = " << errno;
519         EXPECT_STREQ(str, L"helloworld 10") << "fgetws fail, errno = " << errno;
520         EXPECT_NE(fclose(fp1), -1) << "> fclose fail, errno = " << errno;
521     }
522 }
523 
FormatVwscanf(const wchar_t * format,...)524 int FormatVwscanf(const wchar_t *format, ...)
525 {
526     va_list argPtr;
527     va_start(argPtr, format);
528     int ret = vwscanf(format, argPtr);
529     va_end(argPtr);
530     return ret;
531 }
532 
533 /**
534  * @tc.number SUB_KERNEL_IO_WCHAR_2100
535  * @tc.name   vwscanf basic function test
536  * @tc.desc   [C- SOFTWARE -0200]
537  */
538 HWTEST_F(IoTest, testVwscanf, Function | MediumTest | Level1)
539 {
540     FILE *fp = nullptr;
541     INIT_TEST_FILE(fp);
542     pid_t pid = fork();
543     ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
544     if (pid == 0) { // child
545         int rt = 0;
546         FILE *fp1 = freopen(IOTEST_TEMPFILE, "r", stdin);
547         if (fp1 == nullptr) {
548             LOG("freopen fail, errno = %d", errno);
549             rt = 1;
550         }
551         wchar_t str[50] = {0};
552         if (FormatVwscanf(L"%ls", str) != 1) {
553             LOG("vwscanf fail, errno = %d", errno);
554             rt = 1;
555             if (wcscmp(str, L"hello world") != 0) {
556                 LOG("vwscanf fail, errno = %d", errno);
557                 rt = 1;
558             }
559         }
560         if (fclose(fp1) == -1) {
561             LOG("fclose fail, errno = %d", errno);
562         }
563         exit(rt);
564     } else { // parent
565         WaitProcExitedOK(pid);
566     }
567 }
568 
569 /**
570  * @tc.number SUB_KERNEL_IO_WCHAR_2200
571  * @tc.name   getwchar basic function test
572  * @tc.desc   [C- SOFTWARE -0200]
573  */
574 HWTEST_F(IoTest, testGetwchar, Function | MediumTest | Level1)
575 {
576     FILE *fp = nullptr;
577     INIT_TEST_FILE(fp);
578     pid_t pid = fork();
579     ASSERT_TRUE(pid >= 0) << "======== Fork Error! =========";
580     if (pid == 0) { // child
581         int rt = 0;
582         FILE *fp1 = freopen(IOTEST_TEMPFILE, "r", stdin);
583         if (fp1 == nullptr) {
584             LOG("freopen fail, errno = %d", errno);
585             rt = 1;
586         }
587         if (getwchar() != 104) {
588             LOG("getwchar fail, errno = %d", errno);
589             rt = 1;
590         }
591         if (fclose(fp1) == -1) {
592             LOG("fclose fail, errno = %d", errno);
593             rt = 1;
594         }
595         exit(rt);
596     } else { // parent
597         WaitProcExitedOK(pid);
598     }
599 }
600 
601 /**
602  * @tc.number SUB_KERNEL_IO_WCHAR_2300
603  * @tc.name   btowc basic function test
604  * @tc.desc   [C- SOFTWARE -0200]
605  */
606 HWTEST_F(IoTest, testBtowc, Function | MediumTest | Level1)
607 {
608     EXPECT_EQ(btowc('6'), L'6');
609 
610     EXPECT_EQ(btowc('A'), L'A');
611 
612     EXPECT_EQ(btowc('&'), L'&');
613 
614     EXPECT_EQ(btowc(EOF), WEOF);
615 }