From 8b2bc064cd8a9a68d32d5c7cf95e023a1ef306a2 Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Mon, 10 Aug 2020 18:24:21 +0400 Subject: [PATCH] Fixed test and sample decks --- ...Abzan Midrange TDtB ST Dec 2014.mwDeck.dck | 4 ++-- ...Abzan Midrange TDtB ST Nov 2014.mwDeck.dck | 4 ++-- .../Mardu Control TDtB ST Dec 2014.mwDeck.dck | 6 +++--- .../Saint WW TDtB ST Jan 2012.mwDeck.dck | 2 +- Mage.Tests/RB Aggro.dck | 10 ++++----- .../src/main/java/mage/verify/MtgJson.java | 3 ++- .../java/mage/verify/VerifyCardDataTest.java | 21 +++++++++++++------ 7 files changed, 30 insertions(+), 20 deletions(-) diff --git a/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Dec 2014.mwDeck.dck b/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Dec 2014.mwDeck.dck index 96a807222e..72f23e2a97 100644 --- a/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Dec 2014.mwDeck.dck +++ b/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Dec 2014.mwDeck.dck @@ -24,7 +24,7 @@ 2 [M15:198] Satyr Wayfinder 2 [THS:155] Commune with the Gods 2 [THS:180] Sylvan Caryatid -1 [MBP:77] Sylvan Caryatid +1 [THS:180] Sylvan Caryatid 2 [THS:110] Whip of Erebos 1 [F14:2] Elvish Mystic 3 [KTK:81] Murderous Cut @@ -41,4 +41,4 @@ SB: 2 [KTK:8] End Hostilities SB: 1 [JOU:66] Doomwake Giant SB: 1 [C14:213] Reclamation Sage SB: 1 [THS:101] Read the Bones -SB: 1 [MBP:103] Nissa, Worldwaker +SB: 1 [M15:187] Nissa, Worldwaker diff --git a/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Nov 2014.mwDeck.dck b/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Nov 2014.mwDeck.dck index 552b2020db..f4aca6a7d7 100644 --- a/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Nov 2014.mwDeck.dck +++ b/Mage.Client/release/sample-decks/Decks to Beat/Abzan Midrange TDtB ST Nov 2014.mwDeck.dck @@ -27,7 +27,7 @@ 2 [9ED:322] Llanowar Wastes 4 [THS:180] Sylvan Caryatid 1 [ARC:150] Forest -SB: 1 [MBP:101] Liliana Vess +SB: 1 [M15:103] Liliana Vess SB: 2 [M15:169] Back to Nature SB: 1 [F14:8] Bile Blight SB: 2 [BNG:61] Bile Blight @@ -35,5 +35,5 @@ SB: 1 [C14:158] Read the Bones SB: 1 [M15:187] Nissa, Worldwaker SB: 1 [KTK:8] End Hostilities SB: 2 [KTK:163] Anafenza, the Foremost -SB: 1 [MBP:103] Nissa, Worldwaker +SB: 1 [M15:187] Nissa, Worldwaker SB: 3 [BNG:65] Drown in Sorrow diff --git a/Mage.Client/release/sample-decks/Decks to Beat/Mardu Control TDtB ST Dec 2014.mwDeck.dck b/Mage.Client/release/sample-decks/Decks to Beat/Mardu Control TDtB ST Dec 2014.mwDeck.dck index a3c80aa2ff..ad66ba7cd9 100644 --- a/Mage.Client/release/sample-decks/Decks to Beat/Mardu Control TDtB ST Dec 2014.mwDeck.dck +++ b/Mage.Client/release/sample-decks/Decks to Beat/Mardu Control TDtB ST Dec 2014.mwDeck.dck @@ -19,7 +19,7 @@ 1 [SOM:238] Swamp 1 [DDO:1] Elspeth, Sun's Champion 1 [G09:6] Bloodstained Mire -2 [MBP:98] Goblin Rabblemaster +2 [M15:145] Goblin Rabblemaster 1 [KTK:31] Wingmate Roc 2 [KTK:97] Arc Lightning 1 [9ED:320] Caves of Koilos @@ -35,14 +35,14 @@ 1 [TPR:262] Mountain SB: 1 [ULG:7] Erase SB: 1 [THS:15] Glare of Heresy -SB: 1 [MBP:75] Chandra, Pyromaster +SB: 1 [M15:134] Chandra, Pyromaster SB: 2 [THS:112] Anger of the Gods SB: 1 [THS:101] Read the Bones SB: 1 [KTK:104] Burn Away SB: 1 [THS:107] Thoughtseize SB: 1 [C14:158] Read the Bones SB: 1 [KTK:186] Mardu Charm -SB: 1 [MGDC:38] Utter End +SB: 1 [KTK:210] Utter End SB: 1 [KTK:9] Erase SB: 2 [KTK:8] End Hostilities SB: 1 [THS:9] Elspeth, Sun's Champion diff --git a/Mage.Client/release/sample-decks/Decks to Beat/Saint WW TDtB ST Jan 2012.mwDeck.dck b/Mage.Client/release/sample-decks/Decks to Beat/Saint WW TDtB ST Jan 2012.mwDeck.dck index 2ad5f0146b..32c468e760 100644 --- a/Mage.Client/release/sample-decks/Decks to Beat/Saint WW TDtB ST Jan 2012.mwDeck.dck +++ b/Mage.Client/release/sample-decks/Decks to Beat/Saint WW TDtB ST Jan 2012.mwDeck.dck @@ -19,7 +19,7 @@ 1 [ALA:230] Plains 2 [M10:226] Glacial Fortress 1 [M12:227] Glacial Fortress -2 [MBP:32] Mirran Crusader +2 [MBS:14] Mirran Crusader 3 [M12:3] Angelic Destiny 1 [LRW:34] Oblivion Ring 1 [ZEN:232] Plains diff --git a/Mage.Tests/RB Aggro.dck b/Mage.Tests/RB Aggro.dck index ab9cb014d8..36ad5af29b 100644 --- a/Mage.Tests/RB Aggro.dck +++ b/Mage.Tests/RB Aggro.dck @@ -2,12 +2,12 @@ NAME:RB Aggro 1 [SOM:242] Mountain 1 [INV:344] Mountain 1 [INV:345] Mountain -1 [ZEN:263] Mountain +1 [ZEN:242a] Mountain 1 [SHM:294] Mountain -1 [ZEN:264] Mountain +1 [ZEN:242a] Mountain 1 [SHM:295] Mountain 1 [SHM:296] Mountain -1 [ZEN:262] Mountain +1 [ZEN:242a] Mountain 1 [ISD:261] Mountain 1 [ISD:260] Mountain 1 [AVR:240] Mountain @@ -19,7 +19,7 @@ NAME:RB Aggro 1 [M10:245] Mountain 1 [M10:242] Mountain 1 [M10:243] Mountain -1 [PGRU:3] Mountain +1 [PGRU:4] Mountain 1 [MRD:299] Mountain 1 [SOM:245] Mountain 1 [SOM:244] Mountain @@ -67,5 +67,5 @@ NAME:RB Aggro 1 [TSP:295] Mountain 1 [TSP:294] Mountain 1 [ISD:259] Mountain -LAYOUT MAIN:(2,1)(CMC,true,5)|()([PGRU:3],[SHM:296],[AVR:240],[SHM:295],[SHM:294],[TSP:295],[TSP:294],[10E:379],[SOM:245],[ZEN:262],[ZEN:245],[10E:378],[SOM:244],[SOM:243],[ZEN:244],[SOM:242],[ZEN:243],[ZEN:242],[ALA:243],[ALA:242],[M12:245],[CHK:299],[M12:243],[M12:244],[CHK:300],[CHK:301],[M12:242],[CHK:302],[10E:376],[M11:243],[M11:242],[M11:245],[M11:244],[MBS:152],[ALA:244],[ALA:245],[ZEN:263],[ZEN:264],[RAV:301],[RAV:300],[RAV:299],[USG:345],[USG:346],[M10:242],[RAV:302],[USG:343],[USG:344],[ISD:259],[ROE:244],[ISD:261],[ISD:260],[ROE:241],[ROE:242],[ROE:243],[MRD:301],[MRD:300],[MRD:299],[M10:244],[M10:243],[M10:245],[LRW:294],[TMP:343],[LRW:295],[LRW:296],[LRW:297],[TMP:343],[MRD:302],[TMP:343],[TMP:343],[INV:345],[INV:344]) +LAYOUT MAIN:(2,1)(CMC,true,5)|()([PGRU:4],[SHM:296],[AVR:240],[SHM:295],[SHM:294],[TSP:295],[TSP:294],[10E:379],[SOM:245],[ZEN:242a],[ZEN:245],[10E:378],[SOM:244],[SOM:243],[ZEN:244],[SOM:242],[ZEN:243],[ZEN:242],[ALA:243],[ALA:242],[M12:245],[CHK:299],[M12:243],[M12:244],[CHK:300],[CHK:301],[M12:242],[CHK:302],[10E:376],[M11:243],[M11:242],[M11:245],[M11:244],[MBS:152],[ALA:244],[ALA:245],[ZEN:242a],[ZEN:242a],[RAV:301],[RAV:300],[RAV:299],[USG:345],[USG:346],[M10:242],[RAV:302],[USG:343],[USG:344],[ISD:259],[ROE:244],[ISD:261],[ISD:260],[ROE:241],[ROE:242],[ROE:243],[MRD:301],[MRD:300],[MRD:299],[M10:244],[M10:243],[M10:245],[LRW:294],[TMP:343],[LRW:295],[LRW:296],[LRW:297],[TMP:343],[MRD:302],[TMP:343],[TMP:343],[INV:345],[INV:344]) LAYOUT SIDEBOARD:(0,0)(COLOR_IDENTITY,true,5)| diff --git a/Mage.Verify/src/main/java/mage/verify/MtgJson.java b/Mage.Verify/src/main/java/mage/verify/MtgJson.java index d3ab27b490..705564689b 100644 --- a/Mage.Verify/src/main/java/mage/verify/MtgJson.java +++ b/Mage.Verify/src/main/java/mage/verify/MtgJson.java @@ -115,11 +115,12 @@ public final class MtgJson { if (stream == null) { File file = new File(filename); if (!file.exists()) { + System.out.println("Downloading " + filename + " to " + file.getAbsolutePath()); URLConnection connection = new URL("https://mtgjson.com/files/" + filename).openConnection(); connection.setRequestProperty("user-agent", "xmage"); InputStream download = connection.getInputStream(); Files.copy(download, file.toPath(), StandardCopyOption.REPLACE_EXISTING); - System.out.println("Downloaded " + filename + " to " + file.getAbsolutePath()); + System.out.println("Downloading DONE"); } else { System.out.println("Using " + filename + " from " + file.getAbsolutePath()); } diff --git a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java index e9b3550a4f..cbe19b2bb1 100644 --- a/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java +++ b/Mage.Verify/src/test/java/mage/verify/VerifyCardDataTest.java @@ -193,9 +193,10 @@ public class VerifyCardDataTest { skipListAddName(SKIP_LIST_SCRYFALL_DOWNLOAD_SETS, "SWS"); // Star Wars // sample decks checking - some decks can contains unimplemented cards, so ignore it + // file name must be related to sample-decks folder // for linux/windows build system use paths constructor skipListCreate(SKIP_LIST_SAMPLE_DECKS); - skipListAddName(SKIP_LIST_SAMPLE_DECKS, Paths.get("\\Commander\\Commander 2019\\Merciless Rage.dck").toString()); // TODO: delete after Aeon Engine implemented + skipListAddName(SKIP_LIST_SAMPLE_DECKS, Paths.get("Commander", "Commander 2019", "Merciless Rage.dck").toString()); // TODO: delete after Aeon Engine implemented } private final ArrayList outputMessages = new ArrayList<>(); @@ -481,11 +482,19 @@ public class VerifyCardDataTest { public void test_checkSampleDecks() { Collection errorsList = new ArrayList<>(); - // collect all files - final String rootPath = Paths.get("..\\Mage.Client\\release\\sample-decks").toString(); + // workaround to run verify test from IDE or from maven's project root folder + Path rootPath = Paths.get("Mage.Client", "release", "sample-decks"); + if (!Files.exists(rootPath)) { + rootPath = Paths.get("..", "Mage.Client", "release", "sample-decks"); + } + if (!Files.exists(rootPath)) { + Assert.fail("Sample decks: unknown root folder " + rootPath.toAbsolutePath().toString()); + } + + // collect all files in all root's folders Collection filesList = new ArrayList<>(); try { - Files.walkFileTree(Paths.get(rootPath), new SimpleFileVisitor() { + Files.walkFileTree(rootPath, new SimpleFileVisitor() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { filesList.add(file); @@ -496,12 +505,12 @@ public class VerifyCardDataTest { e.printStackTrace(); errorsList.add("Error: sample deck - can't get folder content - " + e.getMessage()); } - Assert.assertTrue("Sample decks: can't find any deck files in " + rootPath, filesList.size() > 0); + Assert.assertTrue("Sample decks: can't find any deck files in " + rootPath.toAbsolutePath().toString(), filesList.size() > 0); // try to open deck files int totalErrorFiles = 0; for (Path deckFile : filesList) { - String deckName = deckFile.toString().replace(rootPath, ""); + String deckName = rootPath.relativize(deckFile).toString(); if (skipListHaveName(SKIP_LIST_SAMPLE_DECKS, deckName)) { continue; }