aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/tests/fuzzer/testcase.cpp
blob: 87d1867e09b4e04fb660e00479065eb861417d2e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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;
}