12 changes: 12 additions & 0 deletions libc/test/include/isfinitel_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isfinite[l] macro ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsFiniteTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISFINITE_TESTS(long double, isfinite)
22 changes: 22 additions & 0 deletions libc/test/include/isinf_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Unittests for isinf macro -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-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 isinf
#error "isinf macro is not defined"
#else
int main(void) {
assert(!isinf(1.0f));
assert(!isinf(1.0));
assert(!isinf(1.0L));
return 0;
}
#endif
12 changes: 12 additions & 0 deletions libc/test/include/isinf_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isinf[d] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsInfTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISINF_TESTS(double, isinf)
12 changes: 12 additions & 0 deletions libc/test/include/isinff_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isinf[f] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsInfTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISINF_TESTS(float, isinf)
12 changes: 12 additions & 0 deletions libc/test/include/isinfl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isinf[l] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsInfTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISINF_TESTS(long double, isinf)
22 changes: 22 additions & 0 deletions libc/test/include/isnan_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Unittests for isnan macro -----------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-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 isnan
#error "isnan macro is not defined"
#else
int main(void) {
assert(!isnan(1.0f));
assert(!isnan(1.0));
assert(!isnan(1.0L));
return 0;
}
#endif
12 changes: 12 additions & 0 deletions libc/test/include/isnan_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isnan[l] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsNanTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISNAN_TESTS(double, isnan)
12 changes: 12 additions & 0 deletions libc/test/include/isnanf_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isnan[f] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsNanTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISNAN_TESTS(float, isnan)
12 changes: 12 additions & 0 deletions libc/test/include/isnanl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for isnan[l] macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "IsNanTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_ISNAN_TESTS(long double, isnan)
25 changes: 25 additions & 0 deletions libc/test/include/signbit_test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//===-- Unittests for signbit macro ---------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-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 signbit
#error "signbit macro is not defined"
#else
int main(void) {
assert(!signbit(1.0f));
assert(!signbit(1.0));
assert(!signbit(1.0L));
assert(signbit(-1.0f));
assert(signbit(-1.0));
assert(signbit(-1.0L));
return 0;
}
#endif
12 changes: 12 additions & 0 deletions libc/test/include/signbit_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittest for signbit [d] macro ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "SignbitTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_SIGNBIT_TESTS(double, signbit)
12 changes: 12 additions & 0 deletions libc/test/include/signbitf_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittests for signbit [f] macro -----------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "SignbitTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_SIGNBIT_TESTS(float, signbit)
12 changes: 12 additions & 0 deletions libc/test/include/signbitl_test.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//===-- Unittests for signbit[l] macro ------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDSList-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "SignbitTest.h"
#include "include/llvm-libc-macros/math-function-macros.h"

LIST_SIGNBIT_TESTS(long double, signbit)