Home | History | Annotate | Download | only in test
      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 Fn adapter. The fuzzer has to find two non-empty
      5 // vectors with the same content.
      6 
      7 #include <iostream>
      8 #include <vector>
      9 
     10 #include "FuzzerFnAdapter.h"
     11 
     12 static void TestFn(std::vector<uint8_t> V1, std::vector<uint8_t> V2) {
     13   if (V1.size() > 0 && V1 == V2) {
     14     std::cout << "BINGO; Found the target, exiting\n";
     15     exit(0);
     16   }
     17 }
     18 
     19 extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
     20   fuzzer::Adapt(TestFn, Data, Size);
     21   return 0;
     22 }
     23 
     24 
     25