aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests/fuzzer/testcase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/fuzzer/testcase.cpp')
-rw-r--r--src/tests/fuzzer/testcase.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/tests/fuzzer/testcase.cpp b/src/tests/fuzzer/testcase.cpp
new file mode 100644
index 0000000..87d1867
--- /dev/null
+++ b/src/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)
+{
+ qDebug() << "cmd" << cmd;
+ if(parser->parseLine(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;
+}