/app/src/test/java/com/r0adkll/deckbuilder/arch/data/features/importer/parser/DeckListParserTest.kt

https://github.com/r0adkll/DeckBox · Kotlin · 168 lines · 158 code · 10 blank · 0 comment · 0 complexity · 8969a8e59dcdc896b953db2a847ea1c9 MD5 · raw file

  1. package com.r0adkll.deckbuilder.arch.data.features.importer.parser
  2. import com.r0adkll.deckbuilder.tools.ModelUtils.EXPANSIONS
  3. import org.amshove.kluent.shouldEqualTo
  4. import org.junit.Test
  5. class DeckListParserTest {
  6. private val parser = DeckListParser()
  7. @Test
  8. fun testDefaultPtcgoDeckList() {
  9. val results = parser.parse(EXPANSIONS, DEFAULT_PTCGO_LIST)
  10. results.size.shouldEqualTo(27)
  11. results.sumBy { it.count }.shouldEqualTo(60)
  12. }
  13. @Test
  14. fun testUserDeckLists() {
  15. val results1 = parser.parse(EXPANSIONS, USER_TEST_DECKS[0])
  16. val results2 = parser.parse(EXPANSIONS, USER_TEST_DECKS[1])
  17. val results3 = parser.parse(EXPANSIONS, USER_TEST_DECKS[2])
  18. results1.size.shouldEqualTo(32)
  19. results2.size.shouldEqualTo(32)
  20. results3.size.shouldEqualTo(21)
  21. results1.sumBy { it.count }.shouldEqualTo(60)
  22. results2.sumBy { it.count }.shouldEqualTo(60)
  23. results3.sumBy { it.count }.shouldEqualTo(60)
  24. }
  25. companion object {
  26. const val DEFAULT_PTCGO_LIST = "****** Decidueye GX / Zoroark GX ******\n" +
  27. "\n" +
  28. "##Pokémon - 21\n" +
  29. "\n" +
  30. "* 1 Espeon-EX BKP 52\n" +
  31. "* 1 Tapu Koko PR-SM SM31\n" +
  32. "* 3 Zorua SLG 52\n" +
  33. "* 2 Zoroark-GX PR-SM SM84\n" +
  34. "* 4 Rowlet SUM 9\n" +
  35. "* 3 Dartrix SUM 10\n" +
  36. "* 4 Decidueye-GX SUM 12\n" +
  37. "* 1 Mewtwo EVO 51\n" +
  38. "* 1 Zoroark BKT 91\n" +
  39. "* 1 Tapu Lele-GX GRI 137\n" +
  40. "\n" +
  41. "##Trainer Cards - 33\n" +
  42. "\n" +
  43. "* 1 Special Charge STS 105\n" +
  44. "* 2 Choice Band GRI 121\n" +
  45. "* 1 Mallow GRI 127\n" +
  46. "* 2 Max Potion GRI 128\n" +
  47. "* 2 Guzma BUS 115\n" +
  48. "* 2 Brigette BKT 134\n" +
  49. "* 2 Float Stone BKT 137\n" +
  50. "* 3 Field Blower GRI 125\n" +
  51. "* 1 Rescue Stretcher GRI 130\n" +
  52. "* 3 Professor Sycamore BKP 107\n" +
  53. "* 3 Rare Candy SUM 129\n" +
  54. "* 4 Ultra Ball SUM 135\n" +
  55. "* 2 Evosoda GEN 62\n" +
  56. "* 4 N FCO 105\n" +
  57. "* 1 Mallow GRI 145\n" +
  58. "\n" +
  59. "##Energy - 6\n" +
  60. "\n" +
  61. "* 4 Double Colorless Energy SUM 136\n" +
  62. "* 2 Grass Energy EX 162\n" +
  63. "\n" +
  64. "Total Cards - 60\n" +
  65. "\n" +
  66. "****** Deck List Generated by DeckBox ******"
  67. val USER_TEST_DECKS = arrayOf(
  68. "#****** Pokémon Trading Card Game Deck List ******\n" +
  69. "2 Rayquaza-EX DRX 85\n" +
  70. "1 Victini NVI 15\n" +
  71. "1 Victini LTR 23\n" +
  72. "2 Dedenne FFI 34\n" +
  73. "3 Pikachu GEN 26\n" +
  74. "2 Raichu XY 43\n" +
  75. "3 Tynamo NVI 38\n" +
  76. "2 Eelektrik NVI 40\n" +
  77. "1 Zapdos LTR 46\n" +
  78. "1 Zapdos ROS 23\n" +
  79. "1 Zekrom NXD 50\n" +
  80. "1 Pokemon Fan Club FAC 107\n" +
  81. "1 N NVI 101\n" +
  82. "2 Skyarrow Bridge NXD 91\n" +
  83. "1 Professor's Letter BKT 146\n" +
  84. "1 Lysandre AOR 78\n" +
  85. "2 Professor Sycamore XY 122\n" +
  86. "1 Karen PR-XY XY177\n" +
  87. "2 Battle Compressor Team Flare Gear PHF 92\n" +
  88. "1 Skyla BCR 134\n" +
  89. "2 Level Ball AOR 76\n" +
  90. "1 Tierno PHF 107\n" +
  91. "2 Switch SUM 132\n" +
  92. "1 Shauna XY 127\n" +
  93. "1 AZ PHF 91\n" +
  94. "1 Bianca LTR 109\n" +
  95. "2 Float Stone BKT 137\n" +
  96. "2 Ultra Ball DEX 102\n" +
  97. "1 Professor Birch's Observations PRC 134\n" +
  98. "1 VS Seeker PHF 109\n" +
  99. "6 Fire Energy Energy 2\n" +
  100. "9 Lightning Energy Energy 4",
  101. "#****** Pokémon Trading Card Game Deck List ******\n" +
  102. "1 Articuno ROS 17\n" +
  103. "2 Feebas DRX 27\n" +
  104. "2 Milotic PRC 44\n" +
  105. "2 Keldeo-EX BCR 49\n" +
  106. "2 Lapras NXD 25\n" +
  107. "1 Regice AOR 24\n" +
  108. "1 Remoraid BKT 32\n" +
  109. "1 Octillery BKT 33\n" +
  110. "3 Squirtle BCR 29\n" +
  111. "2 Wartortle BCR 30\n" +
  112. "2 Blastoise BCR 31\n" +
  113. "2 Rough Seas PRC 137\n" +
  114. "1 N NVI 101\n" +
  115. "1 Archie's Ace in the Hole PRC 124\n" +
  116. "1 Professor's Letter BKT 146\n" +
  117. "1 Lysandre AOR 78\n" +
  118. "2 Professor Sycamore XY 122\n" +
  119. "1 Karen PR-XY XY177\n" +
  120. "1 Fisherman BKT 136\n" +
  121. "1 Escape Rope PRC 127\n" +
  122. "1 Teammates PRC 141\n" +
  123. "1 Skyla BCR 134\n" +
  124. "1 Tierno PHF 107\n" +
  125. "1 Shauna XY 127\n" +
  126. "1 Bianca LTR 109\n" +
  127. "2 Ultra Ball DEX 102\n" +
  128. "1 Professor Birch's Observations PRC 134\n" +
  129. "2 Dive Ball PRC 125\n" +
  130. "2 Rare Candy DEX 100\n" +
  131. "1 VS Seeker PHF 109\n" +
  132. "2 Superior Energy Retrieval PLF 103\n" +
  133. "15 Water Energy Energy 3",
  134. "#****** Pokémon Trading Card Game Deck List ******\n" +
  135. "4 Trubbish BKP 56\n" +
  136. "2 Garbodor BKP 57\n" +
  137. "2 Garbodor GRI 51\n" +
  138. "3 Eevee SUM 101\n" +
  139. "3 Espeon-GX SUM 61\n" +
  140. "1 Drampa-GX GRI 115\n" +
  141. "3 Tapu Lele-GX GRI 60\n" +
  142. "3 N NVI 101\n" +
  143. "3 Cynthia UPR 119\n" +
  144. "3 Guzma BUS 115\n" +
  145. "2 Professor Sycamore XY 122\n" +
  146. "2 Acerola BUS 112\n" +
  147. "1 Brigette BKT 134\n" +
  148. "4 Ultra Ball SLG 68\n" +
  149. "2 Field Blower GRI 125\n" +
  150. "1 Rescue Stretcher GRI 130\n" +
  151. "4 Float Stone BKT 137\n" +
  152. "3 Choice Band GRI 121\n" +
  153. "2 Parallel City BKT 145\n" +
  154. "8 Psychic Energy 5\n" +
  155. "4 Double Colorless Energy EVO 90"
  156. )
  157. }
  158. }