Add collapsible into fuzzer. (#312)

This commit is contained in:
Arthur Sonzogni 2022-01-22 11:44:52 +01:00 committed by GitHub
parent 3829734fa9
commit 4267b40a68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,5 @@
#include <iostream> #include <iostream>
//#include "ftxui/component/event.hpp" #include <cassert>
//#include "ftxui/component/receiver.hpp"
#include <vector> #include <vector>
#include "ftxui/component/component.hpp" #include "ftxui/component/component.hpp"
#include "ftxui/component/terminal_input_parser.hpp" #include "ftxui/component/terminal_input_parser.hpp"
@ -57,7 +56,11 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) {
if (depth <= 0) if (depth <= 0)
return Button(GeneratorString(data, size), [] {}); return Button(GeneratorString(data, size), [] {});
switch (value % 19) { constexpr int value_max = 19;
value = (value % value_max + value_max) % value_max;
switch (value) {
case 0:
return Button(GeneratorString(data, size), [] {});
case 1: case 1:
return Checkbox(GeneratorString(data, size), &g_bool); return Checkbox(GeneratorString(data, size), &g_bool);
case 2: case 2:
@ -106,8 +109,12 @@ Component GeneratorComponent(const char*& data, size_t& size, int depth) {
return Maybe(GeneratorComponent(data, size, depth - 1), &g_bool); return Maybe(GeneratorComponent(data, size, depth - 1), &g_bool);
case 17: case 17:
return Dropdown(&g_list, &g_int); return Dropdown(&g_list, &g_int);
case 18:
return Collapsible(GeneratorString(data, size),
GeneratorComponent(data, size, depth - 1),
GeneratorBool(data, size));
default: default:
return Button(GeneratorString(data, size), [] {}); assert(false);
} }
} }