Print total time and time per card at end of the test.
parent
10bfd0ddd9
commit
d8fcafa0eb
|
@ -50,6 +50,9 @@ public class CardTest {
|
||||||
|
|
||||||
Collection<MagicCardDefinition> allC = CardDefinitions.getAllPlayableCardDefs();
|
Collection<MagicCardDefinition> allC = CardDefinitions.getAllPlayableCardDefs();
|
||||||
|
|
||||||
|
double totalTime = 0;
|
||||||
|
int totalCards = 0;
|
||||||
|
|
||||||
Set<String> skip = new HashSet<>();
|
Set<String> skip = new HashSet<>();
|
||||||
String skipList = cmdline.getSkipList();
|
String skipList = cmdline.getSkipList();
|
||||||
if (skipList != null) {
|
if (skipList != null) {
|
||||||
|
@ -83,8 +86,10 @@ public class CardTest {
|
||||||
for (MagicCardDefinition token : tokens) {
|
for (MagicCardDefinition token : tokens) {
|
||||||
System.out.println("Testing token #" + t + ": " + token.getName());
|
System.out.println("Testing token #" + t + ": " + token.getName());
|
||||||
t++;
|
t++;
|
||||||
|
totalCards++;
|
||||||
MagicGame game = new TokenScenario(token).getGame();
|
MagicGame game = new TokenScenario(token).getGame();
|
||||||
final double duration = runGame(game);
|
final double duration = runGame(game);
|
||||||
|
totalTime += duration;
|
||||||
|
|
||||||
System.out.printf("Token time: %.2fs : %s\n", duration, token);
|
System.out.printf("Token time: %.2fs : %s\n", duration, token);
|
||||||
}
|
}
|
||||||
|
@ -94,12 +99,16 @@ public class CardTest {
|
||||||
for (String name : cards) {
|
for (String name : cards) {
|
||||||
System.out.println("Testing card #" + n + ": " + name);
|
System.out.println("Testing card #" + n + ": " + name);
|
||||||
n++;
|
n++;
|
||||||
|
totalCards++;
|
||||||
MagicGame game = new CardScenario(name).getGame();
|
MagicGame game = new CardScenario(name).getGame();
|
||||||
final double duration = runGame(game);
|
final double duration = runGame(game);
|
||||||
|
totalTime += duration;
|
||||||
|
|
||||||
System.out.printf("Time: %.2fs : %s\n", duration, name);
|
System.out.printf("Time: %.2fs : %s\n", duration, name);
|
||||||
}
|
}
|
||||||
System.out.println("All cards/tokens tested.");
|
System.out.println("Tested " + totalCards + " cards/tokens.");
|
||||||
|
System.out.println("Total time: " + totalTime);
|
||||||
|
System.out.println("Time per card: " + totalTime / totalCards);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static double runGame(MagicGame game) {
|
private static double runGame(MagicGame game) {
|
||||||
|
|
Loading…
Reference in New Issue