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 "functionalext.h"
17
18 /**
19 * @tc.name : signbitl_0100
20 * @tc.desc : The sign bit of the returned argument is 0 (The value of the argument of type long is 0)
21 * @tc.level : Level 0
22 */
signbitl_0100(void)23 void signbitl_0100(void)
24 {
25 long double x = 0.0L;
26 int result = __signbitl(x);
27 EXPECT_EQ("signbitl_0100", result, 0);
28 }
29
30 /**
31 * @tc.name : signbitl_0200
32 * @tc.desc : The sign bit of the returned argument is 0 (The value of the argument of type long is positive)
33 * @tc.level : Level 0
34 */
signbitl_0200(void)35 void signbitl_0200(void)
36 {
37 long double x = 3.14;
38 int result = __signbitl(x);
39 EXPECT_EQ("signbitl_0200", result, 0);
40 }
41
42 /**
43 * @tc.name : signbitl_0300
44 * @tc.desc : The sign bit of the returned parameter is 1 (The parameter value of type long is negative)
45 * @tc.level : Level 0
46 */
signbitl_0300(void)47 void signbitl_0300(void)
48 {
49 long double x = -3.14;
50 int result = __signbitl(x);
51 EXPECT_EQ("signbitl_0300", result, 1);
52 }
53
main(int argc,char * argv[])54 int main(int argc, char *argv[])
55 {
56 signbitl_0100();
57 signbitl_0200();
58 signbitl_0300();
59 return t_status;
60 }