-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
33 lines (31 loc) · 858 Bytes
/
test.c
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
#include "JoshuaTrees.c"
int main(int argc, char *argv[]) {
time_t t;
srand((unsigned)time(&t));
// get a random number between 0 and 600000
int randomNumber = rand() % 600000000;
double time = clock();
JoshuaTree *j = new_JoshuaTree();
StitchedArray *a = j->b(4);
for (int i = 0; i < 600000000; i++) {
if (i % 10000000 == 0){
printf("alloced..");
//flush
fflush(stdout);
}
j->i(a, i, i);
}
int i = j->g(a, randomNumber);
//get 100 random entries
for (int i = 0; i < 60000000; i++) {
// get a random number between 0 and 600000
int randomNumber = rand() % 60000000;
int i = j->g(a, randomNumber);
//printf("%d\n", i);
}
printf("%d\n", i);
// also print random number
printf("%d\n", randomNumber);
// print how long this took
//printf("%f\n", (clock() - time) / CLOCKS_PER_SEC);
}