• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 <stdio.h>
17 #include <stdlib.h>
18 #include <stdbool.h>
19 #include <syslog.h>
20 #include <stdint.h>
21 #include <unistd.h>
22 #include "functionalext.h"
23 
24 /**
25  * @tc.name      : ffsl_0100
26  * @tc.desc      : Validates the ability to find the first set value of a value of type long.
27  * @tc.level     : Level 0
28  */
ffsl_0100(void)29 void ffsl_0100(void)
30 {
31     int result;
32     result = ffsl(0);
33     EXPECT_EQ("ffsl_0100", result, 0);
34 }
35 
36 /**
37  * @tc.name      : ffsl_0200
38  * @tc.desc      : Verify to find the first set value of a value of type long (0x8, bit 1)
39  * @tc.level     : Level 0
40  */
ffsl_0200(void)41 void ffsl_0200(void)
42 {
43     int result;
44     result = ffsl(0x8);
45     EXPECT_EQ("ffsl_0200", result, 4);
46 }
47 
48 /**
49  * @tc.name      : ffsl_0300
50  * @tc.desc      : Validates the ability to find the first set value of a value of type long (0x8000, bit 1)
51  * @tc.level     : Level 0
52  */
ffsl_0300(void)53 void ffsl_0300(void)
54 {
55     int result;
56     result = ffsl(0x8000);
57     EXPECT_EQ("ffsl_0300", result, 16);
58 }
59 
main(int argc,char * argv[])60 int main(int argc, char *argv[])
61 {
62     ffsl_0100();
63     ffsl_0200();
64     ffsl_0300();
65     return t_status;
66 }