-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
35 lines (27 loc) · 1.17 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
#include <iostream>
#include <chrono>
#include "ScriptExecution.h"
int main() {
//auto scriptFromFile = io::readAllBytes("..\\compiled.uiscb");
// BytesUtil::PrintBytes(scriptFromFile);
auto beginTime = std::chrono::steady_clock::now();
try {
int8_t Script[] = {1, 4, 0, 0, 0, 1, 1, 4, 0, 0, 0, 2, -75, 1, 4, 0, 0, 0, 1, -109, -74};
std::vector<int8_t > scriptVector;
scriptVector.insert(scriptVector.begin(), std::begin(Script), std::end(Script));
ScriptExecution scriptExecution(scriptVector);
bool success = scriptExecution.Execute();
std::cout << "Script execution returned: " << (success ? "true" : "false") << std::endl;
} catch (std::exception& e){
std::cout << "Caught exception!" << std::endl;
std::cout << e.what();
return 1;
} catch (...){
std::cout << "Unhandled exception!" << std::endl;
return 2;
}
auto endTime = std::chrono::steady_clock::now();
std::chrono::nanoseconds elapsedNs = std::chrono::duration_cast<std::chrono::nanoseconds>(endTime - beginTime);
std::cout << " in " << elapsedNs.count()/1000000. << " ms." << std::endl;
return 0;
}