Home | History | Annotate | Download | only in tests
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include <gtest/gtest.h>
     18 
     19 #include <float.h>
     20 
     21 TEST(float_h, macros) {
     22 #if !defined(FLT_RADIX)
     23 #error FLT_RADIX
     24 #endif
     25 #if !defined(DECIMAL_DIG)
     26 #error DECIMAL_DIG
     27 #endif
     28 #if !defined(FLT_DECIMAL_DIG)
     29 #error FLT_DECIMAL_DIG
     30 #endif
     31 #if !defined(DBL_DECIMAL_DIG)
     32 #error DBL_DECIMAL_DIG
     33 #endif
     34 #if !defined(LDBL_DECIMAL_DIG)
     35 #error LDBL_DECIMAL_DIG
     36 #endif
     37 #if !defined(FLT_MIN)
     38 #error FLT_MIN
     39 #endif
     40 #if !defined(DBL_MIN)
     41 #error DBL_MIN
     42 #endif
     43 #if !defined(LDBL_MIN)
     44 #error LDBL_MIN
     45 #endif
     46 #if !defined(FLT_EPSILON)
     47 #error FLT_EPSILON
     48 #endif
     49 #if !defined(DBL_EPSILON)
     50 #error DBL_EPSILON
     51 #endif
     52 #if !defined(LDBL_EPSILON)
     53 #error LDBL_EPSILON
     54 #endif
     55 #if !defined(FLT_DIG)
     56 #error FLT_DIG
     57 #endif
     58 #if !defined(DBL_DIG)
     59 #error DBL_DIG
     60 #endif
     61 #if !defined(LDBL_DIG)
     62 #error LDBL_DIG
     63 #endif
     64 #if !defined(FLT_MANT_DIG)
     65 #error FLT_MANT_DIG
     66 #endif
     67 #if !defined(DBL_MANT_DIG)
     68 #error DBL_MANT_DIG
     69 #endif
     70 #if !defined(LDBL_MANT_DIG)
     71 #error LDBL_MANT_DIG
     72 #endif
     73 #if !defined(FLT_MIN_EXP)
     74 #error FLT_MIN_EXP
     75 #endif
     76 #if !defined(DBL_MIN_EXP)
     77 #error DBL_MIN_EXP
     78 #endif
     79 #if !defined(LDBL_MIN_EXP)
     80 #error LDBL_MIN_EXP
     81 #endif
     82 #if !defined(FLT_MIN_10_EXP)
     83 #error FLT_MIN_10_EXP
     84 #endif
     85 #if !defined(DBL_MIN_10_EXP)
     86 #error DBL_MIN_10_EXP
     87 #endif
     88 #if !defined(LDBL_MIN_10_EXP)
     89 #error LDBL_MIN_10_EXP
     90 #endif
     91 #if !defined(FLT_MAX_EXP)
     92 #error FLT_MAX_EXP
     93 #endif
     94 #if !defined(DBL_MAX_EXP)
     95 #error DBL_MAX_EXP
     96 #endif
     97 #if !defined(LDBL_MAX_EXP)
     98 #error LDBL_MAX_EXP
     99 #endif
    100 #if !defined(FLT_MAX_10_EXP)
    101 #error FLT_MAX_10_EXP
    102 #endif
    103 #if !defined(DBL_MAX_10_EXP)
    104 #error DBL_MAX_10_EXP
    105 #endif
    106 #if !defined(LDBL_MAX_10_EXP)
    107 #error LDBL_MAX_10_EXP
    108 #endif
    109 #if !defined(FLT_ROUNDS)
    110 #error FLT_ROUNDS
    111 #endif
    112 #if !defined(FLT_EVAL_METHOD)
    113 #error FLT_EVAL_METHOD
    114 #endif
    115 // TODO: FLT_HAS_SUBNORM currently missing from clang. Negate this test when fixed.
    116 #if defined(FLT_HAS_SUBNORM)
    117 #error FLT_HAS_SUBNORM
    118 #endif
    119 // TODO: DBL_HAS_SUBNORM currently missing from clang. Negate this test when fixed.
    120 #if defined(DBL_HAS_SUBNORM)
    121 #error DBL_HAS_SUBNORM
    122 #endif
    123 // TODO: LDBL_HAS_SUBNORM currently missing from clang. Negate this test when fixed.
    124 #if defined(LDBL_HAS_SUBNORM)
    125 #error LDBL_HAS_SUBNORM
    126 #endif
    127 }
    128