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 <limits.h>
17 #include <unistd.h>
18 #include "functionalext.h"
19
20 /**
21 * @tc.name : fpathconf_0100
22 * @tc.desc : Verify that you can query values related to file system limits and options
23 * (each parameter is valid, the name parameter is _PC_LINK_MAX,)
24 * @tc.level : Level 0
25 */
fpathconf_0100(void)26 void fpathconf_0100(void)
27 {
28 long result = fpathconf(0, _PC_LINK_MAX);
29 EXPECT_EQ("fpathconf_0100", result, _POSIX_LINK_MAX);
30 }
31
32 /**
33 * @tc.name : fpathconf_0200
34 * @tc.desc : Verify that you can query values related to file system limits and options
35 * (each parameter is valid, the name parameter is _PC_SOCK_MAXBUF,)
36 * @tc.level : Level 0
37 */
fpathconf_0200(void)38 void fpathconf_0200(void)
39 {
40 long result = fpathconf(0, _PC_SOCK_MAXBUF);
41 EXPECT_EQ("fpathconf_0200", result, -1);
42 }
43
44 /**
45 * @tc.name : fpathconf_0300
46 * @tc.desc : Verify that you can query values related to file system limits and options
47 * (each parameter is valid, the name parameter is _PC_FILESIZEBITS,)
48 * @tc.level : Level 0
49 */
fpathconf_0300(void)50 void fpathconf_0300(void)
51 {
52 long result = fpathconf(0, _PC_FILESIZEBITS);
53 EXPECT_EQ("fpathconf_0300", result, FILESIZEBITS);
54 }
55
56 /**
57 * @tc.name : fpathconf_0400
58 * @tc.desc : Verify that you can query values related to file system limits and options
59 * (each parameter is valid, the name parameter is _PC_2_SYMLINKS,)
60 * @tc.level : Level 0
61 */
fpathconf_0400(void)62 void fpathconf_0400(void)
63 {
64 long result = fpathconf(0, _PC_2_SYMLINKS);
65 EXPECT_EQ("fpathconf_0400", result, 1);
66 }
67
68 /**
69 * @tc.name : fpathconf_0500
70 * @tc.desc : Verify that you can query values related to file system limits and options
71 * (each parameter is valid, the name parameter is 1000,)
72 * @tc.level : Level 2
73 */
fpathconf_0500(void)74 void fpathconf_0500(void)
75 {
76 long result = fpathconf(0, 1000);
77 EXPECT_EQ("fpathconf_0500", result, -1);
78 }
79
main(int argc,char * argv[])80 int main(int argc, char *argv[])
81 {
82 fpathconf_0100();
83 fpathconf_0200();
84 fpathconf_0300();
85 fpathconf_0400();
86 fpathconf_0500();
87 return t_status;
88 }