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 | |
Marshall Clow | baa6fb3 | 2017-10-04 22:23:03 +0000 | [diff] [blame] | 59 | } // namespace fuzzing |
| 60 | |
| 61 | #endif // _LIBCPP_FUZZING |