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 <stdarg.h>
17 #include <stdio.h>
18 #include <string.h>
19 #include <stdlib.h>
20 #include <signal.h>
21 #include <fcntl.h>
22 #include <wchar.h>
23 #include "test.h"
24
readFile(wchar_t * fmt,...)25 int readFile(wchar_t *fmt, ...)
26 {
27 va_list ap;
28 va_start(ap, fmt);
29 int result = vwprintf(fmt, ap);
30 va_end(ap);
31 return result;
32 }
33
34 /**
35 * @tc.name : vwprintf_0100
36 * @tc.desc : Test the vwprintf method to write a wide string to the console
37 * @tc.level : Level 0
38 */
vwprintf_0100(void)39 void vwprintf_0100(void)
40 {
41 wchar_t *value = L"hello %ls\n";
42 int resule = readFile(value, L"world");
43 if (resule < 0) {
44 t_error("%s vwprintf error get result is %d are not less 0\n", __func__, resule);
45 }
46 }
47
main(int argc,char * argv[])48 int main(int argc, char *argv[])
49 {
50 vwprintf_0100();
51 return t_status;
52 }