aboutsummaryrefslogtreecommitdiff
path: root/libc/test/include/fpclassify_test.c
blob: d52d999301115072104dcd6867bfaab3518f0b0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//===-- Unittests for fpclassify macro ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "include/llvm-libc-macros/math-function-macros.h"

#include <assert.h>

// check if macro is defined
#ifndef fpclassify
#error "fpclassify macro is not defined"
#else
int main(void) {
  assert(fpclassify(1.819f) == FP_NORMAL);
  assert(fpclassify(-1.726) == FP_NORMAL);
  assert(fpclassify(1.426L) == FP_NORMAL);
  assert(fpclassify(-0.0f) == FP_ZERO);
  assert(fpclassify(0.0) == FP_ZERO);
  assert(fpclassify(-0.0L) == FP_ZERO);
  return 0;
}
#endif