-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_CommandGenerator.cpp
36 lines (29 loc) · 1.02 KB
/
test_CommandGenerator.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
// test_CommandGenerator.cpp
#include <iostream>
#include "CommandGenerator.h"
#include <limits>
#include <chrono>
int main() {
float testFloat1 = std::numeric_limits<float>::quiet_NaN();
float testFloat2 = 1.0;
// Start timing
auto start = std::chrono::high_resolution_clock::now();
CommandGenerator generator(testFloat1, testFloat2);
auto command = generator.getCommand();
// Stop timing
auto end = std::chrono::high_resolution_clock::now();
auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end - start).count();
std::cout << "Execution time: " << duration << " microseconds" << std::endl;
//Print
std::cout << "Generated Command: ";
for (auto c : command) {
std::cout << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(c) << "";
}
std::cout << std::endl;
std::cout << " Command: ";
for (auto c : command) {
std::cout << c << "";
}
std::cout << std::endl;
return 0;
}