Prolog Text common

/**
* Common Prolog code for the test harness.
*
* Copyright 2013, XLOG Technologies GmbH, Switzerland
* Jekejeke Minlog 0.6.6 (minimal logic extension module)
*/

/***************************************************/
/* Utilities */
/***************************************************/

for(_).
for(N) :- N > 1, M is N - 1, for(M).

test(N, X) :- for(N), X, fail.
test(_, _).

show(T, G) :-
write('\tin '),
write(T),
write('\t('),
write(G),
write(' gc) ms'), nl.

bench(M, X, T, G) :-
uptime(T1),
gctime(G1),
test(M, X),
uptime(T2),
gctime(G2),
T is T2 - T1,
G is G2 - G1,
functor(X, F, _),
write(F),
show(T, G).

/***************************************************/
/* Runner */
/***************************************************/

dummy.

suite4 :-
bench(1001, dummy, _, _),
bench(1, grocery3(_), T1, G1),
bench(12, pythago3(_), T2, G2),
bench(16, queens3(_), T3, G3),
bench(35, money3(_), T4, G4),
bench(86, crypt3(_), T5, G5),
bench(285, zebra3(_), T6, G6),
bench(13, pigeon3(_), T7, G7),
T is T1+T2+T3+T4+T5+T6+T7,
G is G1+G2+G3+G4+G5+G6+G7,
write('Total'),
show(T, G), nl.

Comments