-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
56 lines (48 loc) · 1.96 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//
// main.cpp
//
#include <iostream>
#include <sstream>
#include <cstdlib>
#include <functional>
#include <string>
#include <map>
#include "Testing.hpp"
std::string getLocalFolder() {
//return std::string("c:/xxx/yyy");
return std::string("/tmp"); //SET PATH TO LOCAL ARCHIVE FOLDER
}
int main(int argc, const char * argv[]) {
srand(time(NULL));
if(argc>1) {
std::string temp(argv[1]);
std::stringstream theOutput;
std::string theFolder(getLocalFolder());
if(3==argc) theFolder=argv[2];
ECE141::Testing theTester(theFolder);
using TestCall = std::function<bool()>;
static std::map<std::string, TestCall> theCalls {
{"Compile", [&](){return true;} },
{"Create", [&](){return theTester.doCreateTests(theOutput);} },
{"Open", [&](){return theTester.doOpenTests(theOutput);} },
{"Add", [&](){return theTester.doAddTests(theOutput);} },
{"Extract", [&](){return theTester.doExtractTests(theOutput);} },
{"Remove", [&](){return theTester.doRemoveTests(theOutput);} },
{"List", [&](){return theTester.doListTests(theOutput);} },
{"Dump", [&](){return theTester.doDumpTests(theOutput);} },
{"Stress", [&](){return theTester.doStressTests(theOutput);} },
{"Compress", [&](){return theTester.doCompressTests(theOutput);} },
{"All", [&](){return theTester.doAllTests(theOutput);} },
};
std::string theCmd(argv[1]);
if(theCalls.count(theCmd)) {
bool theResult = theCalls[theCmd]();
const char* theStatus[]={"FAIL","PASS"};
std::cout << theCmd << " test " << theStatus[theResult] << "\n";
std::cout << "------------------------------\n"
<< theOutput.str() << "\n";
}
else std::cout << "Unknown test\n";
}
return 0;
}