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 <float.h>
17 #include <math.h>
18 #include "functionalext.h"
19
20 /**
21 * @tc.name : __fpclassifyl_0100
22 * @tc.desc : The parameter is valid, x is 1.0, can get the integer value matching the
23 * classification macro constant.
24 * @tc.level : Level 0
25 */
__fpclassifyl_0100(void)26 void __fpclassifyl_0100(void)
27 {
28 long double x = 1.0;
29 int ret = __fpclassifyl(x);
30 EXPECT_EQ("__fpclassifyl_0100", ret, FP_NORMAL);
31 }
32
33 /**
34 * @tc.name : __fpclassifyl_0200
35 * @tc.desc : The parameter is valid, x is NAN, can get the integer value matching the
36 * classification macro constant.
37 * @tc.level : Level 1
38 */
__fpclassifyl_0200(void)39 void __fpclassifyl_0200(void)
40 {
41 long double x = NAN;
42 int ret = __fpclassifyl(x);
43 EXPECT_EQ("__fpclassifyl_0200", ret, FP_NAN);
44 }
45
46 /**
47 * @tc.name : __fpclassifyl_0300
48 * @tc.desc : The parameter is valid, x is INFINITY, can get the integer value matching the
49 * classification macro constant.
50 * @tc.level : Level 1
51 */
__fpclassifyl_0300(void)52 void __fpclassifyl_0300(void)
53 {
54 long double x = INFINITY;
55 int ret = __fpclassifyl(x);
56 EXPECT_EQ("__fpclassifyl_0300", ret, FP_INFINITE);
57 }
58
59 /**
60 * @tc.name : __fpclassifyl_0400
61 * @tc.desc : The parameter is valid, x is -0.0, can get the integer value matching the
62 * classification macro constant.
63 * @tc.level : Level 1
64 */
__fpclassifyl_0400(void)65 void __fpclassifyl_0400(void)
66 {
67 long double x = -0.0;
68 int ret = __fpclassifyl(x);
69 EXPECT_EQ("__fpclassifyl_0400", ret, FP_ZERO);
70 }
71
72
main(int argc,char * argv[])73 int main(int argc, char *argv[])
74 {
75 __fpclassifyl_0100();
76 __fpclassifyl_0200();
77 __fpclassifyl_0300();
78 __fpclassifyl_0400();
79 return t_status;
80 }