xref: /llvm-project/libc/test/include/fpclassify_test.c (revision 1dbc98294adc06e409b1e0d44252826857ac2ec6)
156124feeSShourya Goel //===-- Unittests for fpclassify macro ------------------------------------===//
256124feeSShourya Goel //
356124feeSShourya Goel // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
456124feeSShourya Goel // See https://llvm.org/LICENSE.txt for license information.
5*1dbc9829SRoland McGrath // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
656124feeSShourya Goel //
756124feeSShourya Goel //===----------------------------------------------------------------------===//
856124feeSShourya Goel #include "include/llvm-libc-macros/math-function-macros.h"
956124feeSShourya Goel 
1056124feeSShourya Goel #include <assert.h>
1156124feeSShourya Goel 
1256124feeSShourya Goel // check if macro is defined
1356124feeSShourya Goel #ifndef fpclassify
1456124feeSShourya Goel #error "fpclassify macro is not defined"
1556124feeSShourya Goel #else
1656124feeSShourya Goel int main(void) {
1756124feeSShourya Goel   assert(fpclassify(1.819f) == FP_NORMAL);
1856124feeSShourya Goel   assert(fpclassify(-1.726) == FP_NORMAL);
1956124feeSShourya Goel   assert(fpclassify(1.426L) == FP_NORMAL);
2056124feeSShourya Goel   assert(fpclassify(-0.0f) == FP_ZERO);
2156124feeSShourya Goel   assert(fpclassify(0.0) == FP_ZERO);
2256124feeSShourya Goel   assert(fpclassify(-0.0L) == FP_ZERO);
2356124feeSShourya Goel   return 0;
2456124feeSShourya Goel }
2556124feeSShourya Goel #endif
26