-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTestBox.h
More file actions
53 lines (42 loc) · 1.14 KB
/
Copy pathTestBox.h
File metadata and controls
53 lines (42 loc) · 1.14 KB
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
#ifndef TESTBOX_H
#define TESTBOX_H
#include "BOXVM.h"
#include "CPUTime.h"
#include "BoxInfo.h"
void NativeC()
{
double pi = 0;
const double constant = 4;
double i = 1, limit = 100000;
while (i < limit)
{
pi += constant / i;
i += 2;
pi -= constant / i;
i += 2;
}
}
void Testing()
{
int argc = 2;
char *argv[32] = { "", "D:\\DUJE\\Materijali zavrsni rad\\Programi za testiranje\\Pi\\Pi.box" };
CPUTime testspeed;
double BOX_time = 0, C_time = 0, C_val = 0, BOX_val = 0;
printf("\n\t\t[ Running test program ]\n");
runBoxPartByPart(argc, argv);
testspeed.start();
runBox(argc, argv);
testspeed.stop();
BOX_time = testspeed.getCpuTime();
BOX_val = testspeed.getCpuTicks();
testspeed.start();
NativeC();
testspeed.stop();
C_time = testspeed.getCpuTime();
C_val = testspeed.getCpuTicks();
std::cout.precision(15);
std::cout << "\n BOX program time: .... " << BOX_time << " ms";
std::cout << "\n C program time: ...... " << C_time << " ms";
std::cout << "\n <BOX:C> .............. " << BOX_val / C_val << "\n\n";
}
#endif