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 : __fpclassifyf_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 */ 26void __fpclassifyf_0100(void) 27{ 28 float x = 1.0; 29 int ret = __fpclassifyf(x); 30 EXPECT_EQ("__fpclassifyf_0100", ret, FP_NORMAL); 31} 32 33/** 34 * @tc.name : __fpclassifyf_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 */ 39void __fpclassifyf_0200(void) 40{ 41 float x = NAN; 42 int ret = __fpclassifyf(x); 43 EXPECT_EQ("__fpclassifyf_0200", ret, FP_NAN); 44} 45 46/** 47 * @tc.name : __fpclassifyf_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 */ 52void __fpclassifyf_0300(void) 53{ 54 float x = INFINITY; 55 int ret = __fpclassifyf(x); 56 EXPECT_EQ("__fpclassifyf_0300", ret, FP_INFINITE); 57} 58 59/** 60 * @tc.name : __fpclassifyf_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 */ 65void __fpclassifyf_0400(void) 66{ 67 float x = -0.0; 68 int ret = __fpclassifyf(x); 69 EXPECT_EQ("__fpclassifyf_0400", ret, FP_ZERO); 70} 71 72int main(int argc, char *argv[]) 73{ 74 __fpclassifyf_0100(); 75 __fpclassifyf_0200(); 76 __fpclassifyf_0300(); 77 __fpclassifyf_0400(); 78 return t_status; 79}