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