mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-28 16:29:34 +08:00
Add general fuzzer. (#159)
This commit is contained in:
23
src/ftxui/component/terminal_input_parser_test_fuzzer.cpp
Normal file
23
src/ftxui/component/terminal_input_parser_test_fuzzer.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//#include "ftxui/component/event.hpp"
|
||||
//#include "ftxui/component/receiver.hpp"
|
||||
#include <vector>
|
||||
#include "ftxui/component/terminal_input_parser.hpp"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const char* data, size_t size) {
|
||||
using namespace ftxui;
|
||||
auto event_receiver = MakeReceiver<Event>();
|
||||
{
|
||||
auto parser = TerminalInputParser(event_receiver->MakeSender());
|
||||
for (size_t i = 0; i < size; ++i)
|
||||
parser.Add(data[i]);
|
||||
}
|
||||
|
||||
Event received;
|
||||
while (event_receiver->Receive(&received))
|
||||
;
|
||||
return 0; // Non-zero return values are reserved for future use.
|
||||
}
|
||||
|
||||
// Copyright 2021 Arthur Sonzogni. All rights reserved.
|
||||
// Use of this source code is governed by the MIT license that can be found in
|
||||
// the LICENSE file.
|
Reference in New Issue
Block a user