]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/fuzzer/ReadBinaryTest.cpp
Vendor import of compiler-rt trunk r351319 (just before the release_80
[FreeBSD/FreeBSD.git] / test / fuzzer / ReadBinaryTest.cpp
1 // This file is distributed under the University of Illinois Open Source
2 // License. See LICENSE.TXT for details.
3
4 // Simple test for a fuzzer. Tests that fuzzer can read a file containing
5 // carriage returns.
6 #include <cstddef>
7 #include <cstdint>
8 #include <iostream>
9 #include <string>
10
11 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
12   std::string InputStr(reinterpret_cast<const char*>(Data), Size);
13   std::string MagicStr("Hello\r\nWorld\r\n");
14   if (InputStr == MagicStr) {
15     std::cout << "BINGO!";
16   }
17   return 0;
18 }