/*
 *    TEST.C
 *
 *      provadi rychlostni testy ...
 *
 */

#define TESTTIME	5
/* #define SKOK         5 */

#include <stdio.h>
#include <time.h>
#include "data.h"

int benchmark(THra * H)
{
	int p, j;
	long i;
	time_t t1, t2;
	TMG mvg;
	THra temp;
	char tah[5];
	i = 0;
	time(&t1);
	time(&t2);
	while ((t2 - t1) <= TESTTIME) {
		p = MoveGen(H, mvg, 0);
		for (j = 0; j < p; j++) {
			temp = *H;
			Num2Not(mvg[j].odkud, &tah[0]);
			Num2Not(mvg[j].kam, &tah[2]);
			ZpracujTah(tah, &temp);
			Ohodnot(&temp);
		}
		i++;
		time(&t2);
	}
	if (t2 - t1 > 0)
		return (p * i / (t2 - t1));
	else
		return 0;
}
