xref: /llvm-project/libc/test/include/iszero_test.c (revision 1dbc98294adc06e409b1e0d44252826857ac2ec6)
1739ede40SShourya Goel //===-- Unittests for iszero macro ----------------------------------------===//
2739ede40SShourya Goel //
3739ede40SShourya Goel // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4739ede40SShourya Goel // See https://llvm.org/LICENSE.txt for license information.
5*1dbc9829SRoland McGrath // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6739ede40SShourya Goel //
7739ede40SShourya Goel //===----------------------------------------------------------------------===//
8739ede40SShourya Goel #include "include/llvm-libc-macros/math-function-macros.h"
9739ede40SShourya Goel 
10739ede40SShourya Goel #include <assert.h>
11739ede40SShourya Goel 
12739ede40SShourya Goel // check if macro is defined
13739ede40SShourya Goel #ifndef iszero
14739ede40SShourya Goel #error "iszero macro is not defined"
15739ede40SShourya Goel #else
16739ede40SShourya Goel int main(void) {
17739ede40SShourya Goel   assert(iszero(1.0f) == 0);
18739ede40SShourya Goel   assert(iszero(1.0) == 0);
19739ede40SShourya Goel   assert(iszero(1.0L) == 0);
20739ede40SShourya Goel   assert(iszero(0.0f) == 1);
21739ede40SShourya Goel   assert(iszero(0.0) == 1);
22739ede40SShourya Goel   assert(iszero(0.0L) == 1);
23739ede40SShourya Goel   return 0;
24739ede40SShourya Goel }
25739ede40SShourya Goel #endif
26