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