From 611aa0defd63ebc3b4e3d16a86c495a9af120728 Mon Sep 17 00:00:00 2001 From: Renaud G Date: Thu, 25 Jul 2019 10:10:32 +0200 Subject: add fuzzer test --- tests/fuzzer/testcase.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 tests/fuzzer/testcase.cpp (limited to 'tests/fuzzer/testcase.cpp') diff --git a/tests/fuzzer/testcase.cpp b/tests/fuzzer/testcase.cpp new file mode 100644 index 0000000..2660496 --- /dev/null +++ b/tests/fuzzer/testcase.cpp @@ -0,0 +1,37 @@ +#include +#include +#include +#include + +static DiceParser* parser= new DiceParser(); + +void runCommand(const QString& cmd) +{ + if(parser->parseLine(cmd)) + { + // qDebug() << "valide cmd" << cmd; + parser->start(); + } +} + +int main(int argc, char** argv) +{ + // qDebug() << "first"; + QCoreApplication app(argc, argv); + + // qDebug() << "start"; + QFile file(app.arguments().at(1)); + // qDebug() << "file" << app.arguments().at(1); + if(!file.open(QIODevice::ReadOnly)) + return 1; + + auto line= file.readLine(); + while(!line.isEmpty()) + { + // qDebug() << line; + runCommand(QString::fromUtf8(line)); + line= file.readLine(); + } + + return 0; +} -- cgit v1.2.3-70-g09d2