xref: /llvm-project/libc/fuzzing/math/nextafter_differential_fuzz.cpp (revision 3497211d80c22e1c488f1617db1d70413a2096ec)
1 //===-- nextafter_differential_fuzz.cpp
2 //---------------------------------------===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 ///
10 /// Differential fuzz test for llvm-libc nextafter implementation.
11 ///
12 //===----------------------------------------------------------------------===//
13 
14 #include "fuzzing/math/TwoInputSingleOutputDiff.h"
15 
16 #include "src/math/nextafter.h"
17 #include "src/math/nextafterf.h"
18 #include "src/math/nextafterl.h"
19 
20 #include <math.h>
21 
22 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
23   TwoInputSingleOutputDiff<float, float>(&LIBC_NAMESPACE::nextafterf,
24                                          &::nextafterf, data, size);
25   TwoInputSingleOutputDiff<double, double>(&LIBC_NAMESPACE::nextafter,
26                                            &::nextafter, data, size);
27   return 0;
28 }
29