-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
41 lines (37 loc) · 1.06 KB
/
main.cpp
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
38
39
40
41
#include <QCoreApplication>
#include <tests/test_graham.h>
#include <tests/test_parsevertexlist.h>
#include <tests/test_sortlist.h>
#include <QDebug>
void testing(){
QTest::qExec(new test_sortList);
QTest::qExec(new test_graham);
QTest::qExec(new test_parseVertexList);
}
int main(int argc, char *argv[])
{
if (argc == 1){
testing();
}
else if (argc > 1){
QString data;
QList<Vertex> vl;
QList<Vertex> poligon;
if (readFile(argv[1], data)){
if (parseVertexList(data, vl)){
graham(vl, poligon);
if (argc == 2){
if (!writeVertexList("OUT.TXT", poligon))
qDebug() << "Can not open file: OUT.TXT";
}
else {
if (!writeVertexList(argv[2], poligon))
qDebug() << "Can not open file: " << argv[2];
}
}
qDebug() << "Invalid input data!";
}
qDebug() << "Cannot open file: " << argv[1];
}
return 0;
}