• 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 <math.h>
17 #include <stdlib.h>
18 #include "functionalext.h"
19 
20 const float argNum1 = 2.4;
21 const float argNum2 = 3.9;
22 const float argNum3 = -2.4;
23 const float argNum4 = -3.9;
24 
25 const int32_t retNum1 = 2;
26 const int32_t retNum2 = 4;
27 const int32_t retNum3 = -2;
28 const int32_t retNum4 = -4;
29 
30 /**
31  * @tc.name      : rint_0100
32  * @tc.desc      : Verify rint process success and return 0 when param is 2.4
33  * @tc.level     : Level 0
34  */
rint_0100(void)35 void rint_0100(void)
36 {
37     int32_t ret = rint(argNum1);
38     EXPECT_EQ("rint_0100", ret, retNum1);
39 }
40 
41 /**
42  * @tc.name      : rint_0200
43  * @tc.desc      : Verify rint process success and return 0 when param is 3.9
44  * @tc.level     : Level 0
45  */
rint_0200(void)46 void rint_0200(void)
47 {
48     int32_t ret = rint(argNum2);
49     EXPECT_EQ("rint_0200", ret, retNum2);
50 }
51 
52 /**
53  * @tc.name      : rint_0300
54  * @tc.desc      : Verify rint process success and return 0 when param is -2.4
55  * @tc.level     : Level 0
56  */
rint_0300(void)57 void rint_0300(void)
58 {
59     int32_t ret = rint(argNum3);
60     EXPECT_EQ("rint_0300", ret, retNum3);
61 }
62 
63 /**
64  * @tc.name      : rint_0400
65  * @tc.desc      : Verify rint process success and return 0 when param is -3.9
66  * @tc.level     : Level 0
67  */
rint_0400(void)68 void rint_0400(void)
69 {
70     int32_t ret = rint(argNum4);
71     EXPECT_EQ("rint_0300", ret, retNum4);
72 }
73 
74 /**
75  * @tc.name      : rint_0500
76  * @tc.desc      : Verify rint process success and return 0 when param is 0
77  * @tc.level     : Level 0
78  */
rint_0500(void)79 void rint_0500(void)
80 {
81     int32_t ret = rint(0);
82     EXPECT_EQ("rint_0400", ret, 0);
83 }
84 
main(void)85 int main(void)
86 {
87     rint_0100();
88     rint_0200();
89     rint_0300();
90     rint_0400();
91     rint_0500();
92     return t_status;
93 }
94