From d8fcafa0eb5194d6e9423fc36950e134d269a37c Mon Sep 17 00:00:00 2001 From: Bilbo Date: Sun, 8 Dec 2019 08:20:42 +0100 Subject: [PATCH] Print total time and time per card at end of the test. --- src/magic/CardTest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/magic/CardTest.java b/src/magic/CardTest.java index b4ab211d34..bb5f75d27c 100644 --- a/src/magic/CardTest.java +++ b/src/magic/CardTest.java @@ -50,6 +50,9 @@ public class CardTest { Collection allC = CardDefinitions.getAllPlayableCardDefs(); + double totalTime = 0; + int totalCards = 0; + Set skip = new HashSet<>(); String skipList = cmdline.getSkipList(); if (skipList != null) { @@ -83,8 +86,10 @@ public class CardTest { for (MagicCardDefinition token : tokens) { System.out.println("Testing token #" + t + ": " + token.getName()); t++; + totalCards++; MagicGame game = new TokenScenario(token).getGame(); final double duration = runGame(game); + totalTime += duration; System.out.printf("Token time: %.2fs : %s\n", duration, token); } @@ -94,12 +99,16 @@ public class CardTest { for (String name : cards) { System.out.println("Testing card #" + n + ": " + name); n++; + totalCards++; MagicGame game = new CardScenario(name).getGame(); final double duration = runGame(game); + totalTime += duration; 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) {