Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===-------------------------- fuzzing.h --------------------------------===// |
| 3 | // |
Chandler Carruth | d201210 | 2019-01-19 10:56:40 +0000 | [diff] [blame] | 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 |
Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | |
| 10 | #ifndef _LIBCPP_FUZZING |
| 11 | #define _LIBCPP_FUZZING |
| 12 | |
| 13 | #include <cstddef> // for size_t |
| 14 | #include <cstdint> // for uint8_t |
| 15 | |
| 16 | namespace fuzzing { |
| 17 | |
Marshall Clow | a97ab84 | 2017-10-23 23:19:30 +0000 | [diff] [blame] | 18 | // These all return 0 on success; != 0 on failure |
| 19 | int sort (const uint8_t *data, size_t size); |
| 20 | int stable_sort (const uint8_t *data, size_t size); |
| 21 | int partition (const uint8_t *data, size_t size); |
Marshall Clow | 974677c | 2017-10-30 19:51:58 +0000 | [diff] [blame] | 22 | int partition_copy (const uint8_t *data, size_t size); |
Marshall Clow | a97ab84 | 2017-10-23 23:19:30 +0000 | [diff] [blame] | 23 | int stable_partition (const uint8_t *data, size_t size); |
Marshall Clow | 974677c | 2017-10-30 19:51:58 +0000 | [diff] [blame] | 24 | int unique (const uint8_t *data, size_t size); |
| 25 | int unique_copy (const uint8_t *data, size_t size); |
Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 26 | |
Marshall Clow | a97ab84 | 2017-10-23 23:19:30 +0000 | [diff] [blame] | 27 | // partition and stable_partition take Bi-Di iterators. |
| 28 | // Should test those, too |
Marshall Clow | 974677c | 2017-10-30 19:51:58 +0000 | [diff] [blame] | 29 | int nth_element (const uint8_t *data, size_t size); |
| 30 | int partial_sort (const uint8_t *data, size_t size); |
| 31 | int partial_sort_copy (const uint8_t *data, size_t size); |
Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 32 | |
Marshall Clow | a97ab84 | 2017-10-23 23:19:30 +0000 | [diff] [blame] | 33 | // Heap operations |
| 34 | int make_heap (const uint8_t *data, size_t size); |
| 35 | int push_heap (const uint8_t *data, size_t size); |
| 36 | int pop_heap (const uint8_t *data, size_t size); |
Marshall Clow | d84736b | 2017-10-12 14:48:09 +0000 | [diff] [blame] | 37 | |
Marshall Clow | a97ab84 | 2017-10-23 23:19:30 +0000 | [diff] [blame] | 38 | // Various flavors of regex |
| 39 | int regex_ECMAScript (const uint8_t *data, size_t size); |
| 40 | int regex_POSIX (const uint8_t *data, size_t size); |
| 41 | int regex_extended (const uint8_t *data, size_t size); |
| 42 | int regex_awk (const uint8_t *data, size_t size); |
| 43 | int regex_grep (const uint8_t *data, size_t size); |
| 44 | int regex_egrep (const uint8_t *data, size_t size); |
| 45 | |
| 46 | // Searching |
| 47 | int search (const uint8_t *data, size_t size); |
| 48 | // int search_boyer_moore (const uint8_t *data, size_t size); |
| 49 | // int search_boyer_moore_horspool (const uint8_t *data, size_t size); |
Marshall Clow | d84736b | 2017-10-12 14:48:09 +0000 | [diff] [blame] | 50 | |
Marshall Clow | 974677c | 2017-10-30 19:51:58 +0000 | [diff] [blame] | 51 | // Set operations |
| 52 | // int includes (const uint8_t *data, size_t size); |
| 53 | // int set_union (const uint8_t *data, size_t size); |
| 54 | // int set_intersection (const uint8_t *data, size_t size); |
| 55 | // int set_difference (const uint8_t *data, size_t size); |
| 56 | // int set_symmetric_difference (const uint8_t *data, size_t size); |
| 57 | // int merge (const uint8_t *data, size_t size); |
| 58 | |
Eric Fiselier | 0aaa327 | 2019-12-11 15:45:48 -0500 | [diff] [blame] | 59 | // Random numbers |
| 60 | int uniform_int_distribution(const uint8_t*, size_t); |
| 61 | int uniform_real_distribution(const uint8_t*, size_t); |
| 62 | int bernoulli_distribution(const uint8_t*, size_t); |
| 63 | int poisson_distribution(const uint8_t*, size_t); |
| 64 | int geometric_distribution(const uint8_t*, size_t); |
| 65 | int binomial_distribution(const uint8_t*, size_t); |
| 66 | int negative_binomial_distribution(const uint8_t*, size_t); |
| 67 | int exponential_distribution(const uint8_t*, size_t); |
| 68 | int gamma_distribution(const uint8_t*, size_t); |
| 69 | int weibull_distribution(const uint8_t*, size_t); |
| 70 | int extreme_value_distribution(const uint8_t*, size_t); |
| 71 | int normal_distribution(const uint8_t*, size_t); |
| 72 | int lognormal_distribution(const uint8_t*, size_t); |
| 73 | int chi_squared_distribution(const uint8_t*, size_t); |
| 74 | int cauchy_distribution(const uint8_t*, size_t); |
| 75 | int fisher_f_distribution(const uint8_t*, size_t); |
| 76 | int student_t_distribution(const uint8_t*, size_t); |
| 77 | int discrete_distribution(const uint8_t*, size_t); |
| 78 | int piecewise_constant_distribution(const uint8_t*, size_t); |
| 79 | int piecewise_linear_distribution(const uint8_t*, size_t); |
| 80 | |
Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 81 | } // namespace fuzzing |
| 82 | |
| 83 | #endif // _LIBCPP_FUZZING |