mirror of
https://github.com/magefree/mage.git
synced 2025-12-21 02:52:02 -08:00
tests: add more info to booster generation test output
This commit is contained in:
parent
557b2f681f
commit
c50147b09c
1 changed files with 17 additions and 3 deletions
|
|
@ -511,6 +511,15 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String output formatter for the below debug test
|
||||||
|
private static String getManaCostOrColorIdentity(Card card) {
|
||||||
|
String result = card.getManaCost().getText();
|
||||||
|
if (result.isEmpty()) {
|
||||||
|
result = "[" + card.getColorIdentity().toString().replace("{", "").replace("}", "") + "]";
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Ignore // debug only: collect info about cards in boosters, see https://github.com/magefree/mage/issues/8081
|
@Ignore // debug only: collect info about cards in boosters, see https://github.com/magefree/mage/issues/8081
|
||||||
@Test
|
@Test
|
||||||
public void test_CollectBoosterStats() {
|
public void test_CollectBoosterStats() {
|
||||||
|
|
@ -524,7 +533,12 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
List<Card> booster = setToAnalyse.createBooster();
|
List<Card> booster = setToAnalyse.createBooster();
|
||||||
totalCards += booster.size();
|
totalCards += booster.size();
|
||||||
booster.forEach(card -> {
|
booster.forEach(card -> {
|
||||||
String code = String.format("%s %s %s", card.getExpansionSetCode(), card.getRarity().toString().charAt(0), card.getName());
|
String code = String.format("%s %s %3s %-32s %18s",
|
||||||
|
card.getExpansionSetCode(),
|
||||||
|
card.getRarity().toString().charAt(0),
|
||||||
|
card.getCardNumber(),
|
||||||
|
card.getName(),
|
||||||
|
getManaCostOrColorIdentity(card));
|
||||||
resRatio.putIfAbsent(code, 0);
|
resRatio.putIfAbsent(code, 0);
|
||||||
resRatio.computeIfPresent(code, (u, count) -> count + 1);
|
resRatio.computeIfPresent(code, (u, count) -> count + 1);
|
||||||
});
|
});
|
||||||
|
|
@ -536,14 +550,14 @@ public class BoosterGenerationTest extends MageTestPlayerBase {
|
||||||
.map(Map.Entry::getValue)
|
.map(Map.Entry::getValue)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (!rarityCounts.isEmpty()) {
|
if (!rarityCounts.isEmpty()) {
|
||||||
System.out.println(rarity + String.format(": %s unique, min %s, max %s, total %s",
|
System.out.println(rarity + String.format(": %3s unique, min %5s, max %5s, total %7s",
|
||||||
rarityCounts.size(), Collections.min(rarityCounts), Collections.max(rarityCounts),
|
rarityCounts.size(), Collections.min(rarityCounts), Collections.max(rarityCounts),
|
||||||
rarityCounts.stream().mapToInt(x -> x).sum()));
|
rarityCounts.stream().mapToInt(x -> x).sum()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<String> info = resRatio.entrySet().stream()
|
List<String> info = resRatio.entrySet().stream()
|
||||||
.sorted((o1, o2) -> Integer.compare(o2.getValue(), o1.getValue()))
|
.sorted((o1, o2) -> Integer.compare(o2.getValue(), o1.getValue()))
|
||||||
.map(e -> String.format("%s: %d",
|
.map(e -> String.format("%s: %5d",
|
||||||
e.getKey(),
|
e.getKey(),
|
||||||
e.getValue()
|
e.getValue()
|
||||||
))
|
))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue