diff options
| author | 2019-07-25 10:10:32 +0200 | |
|---|---|---|
| committer | 2019-07-25 10:10:32 +0200 | |
| commit | 611aa0defd63ebc3b4e3d16a86c495a9af120728 (patch) | |
| tree | 08dbfc737c2ca3ffd34e64558229ab1e68d1b375 /tests/fuzzer/testcase.cpp | |
| parent | d64ad7bb3e8fd632217ba0e8aae0586d8ed72ac6 (diff) | |
| download | OneRoll-611aa0defd63ebc3b4e3d16a86c495a9af120728.tar.gz OneRoll-611aa0defd63ebc3b4e3d16a86c495a9af120728.zip | |
add fuzzer test
Diffstat (limited to 'tests/fuzzer/testcase.cpp')
| -rw-r--r-- | tests/fuzzer/testcase.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
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 <QCoreApplication> +#include <QDebug> +#include <QFile> +#include <diceparser.h> + +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; +} |