Skip to content

Commit 533eae7

Browse files
kevinthegreat1lineargraph
authored andcommitted
Update NEURepoParserTest
1 parent dc7e4d9 commit 533eae7

File tree

1 file changed

+55
-30
lines changed

1 file changed

+55
-30
lines changed

src/test/java/io/github/moulberry/repo/NEURepoParserTest.java

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,62 @@
22

33
import io.github.moulberry.repo.data.*;
44
import org.junit.jupiter.api.Assertions;
5+
import org.junit.jupiter.api.BeforeAll;
56
import org.junit.jupiter.api.Test;
67

78
import java.nio.file.Paths;
9+
import java.util.Collections;
810
import java.util.stream.Collectors;
9-
import java.util.stream.Stream;
1011

1112
public class NEURepoParserTest {
12-
@Test
13-
public void test() throws NEURepositoryException {
13+
private static final NEURepository repository = NEURepository.of(Paths.get("NotEnoughUpdates-REPO"));
14+
private static final NEURecipeCache recipes = NEURecipeCache.forRepo(repository);
15+
16+
@BeforeAll
17+
static void beforeAll() throws NEURepositoryException {
1418
System.out.printf("Parser v%s%n", NEURepositoryVersion.REPOSITORY_PARSER_VERSION);
1519
System.out.printf("Schema %d.%d%n", NEURepositoryVersion.REPOSITORY_SCHEMA_VERSION_MAJOR, NEURepositoryVersion.REPOSITORY_SCHEMA_VERSION_MINOR);
1620

17-
NEURepository repository = NEURepository.of(Paths.get("NotEnoughUpdates-REPO"));
18-
NEURecipeCache recipes = NEURecipeCache.forRepo(repository);
1921
repository.reload();
20-
System.out.println("unknown recipe types: " + repository.getItems().getItems().values().stream()
21-
.flatMap(it -> it.getRecipes().stream())
22-
.filter(it -> it instanceof NEUUnknownRecipe).map(it -> (NEUUnknownRecipe) it)
23-
.map(NEUUnknownRecipe::getType)
24-
.collect(Collectors.toSet()));
22+
}
23+
24+
@Test
25+
void testPetConstants() {
2526
Assertions.assertEquals("MINING", repository.getConstants().getPetLevelingData().getPetExpTypes().get("ROCK"));
2627
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[0.2, 0.1, 10.0, 0.2], statNumbers={ABILITY_DAMAGE=0.0, INTELLIGENCE=1.0})", repository.getConstants().getPetNumbers().get("SHEEP").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(1).toString());
2728
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[74.74747474747474, 0.3787878787878788, 0.17424242424242425], statNumbers={STRENGTH=37.37373737373737, MAGIC_FIND=4.94949494949495, BONUS_ATTACK_SPEED=37.37373737373737})", repository.getConstants().getPetNumbers().get("GOLDEN_DRAGON").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(150).toString());
2829
Assertions.assertEquals(200, repository.getConstants().getPetLevelingData().getPetLevelingBehaviourOverrides().get("GOLDEN_DRAGON").getMaxLevel());
30+
}
31+
32+
@Test
33+
void testLevelingConstants() {
34+
int expTotal = 235268;
35+
int expLeft = expTotal;
36+
int level = 0;
37+
for (int expRequiredForThisLevel : repository.getConstants().getLeveling().getSkillExperienceRequiredPerLevel()) {
38+
if (expLeft > expRequiredForThisLevel) {
39+
level++;
40+
expLeft -= expRequiredForThisLevel;
41+
}
42+
}
43+
Assertions.assertEquals(235268, expTotal);
44+
Assertions.assertEquals(18, level);
45+
Assertions.assertEquals(12843, expLeft);
46+
}
47+
48+
@Test
49+
void testMiscConstants() {
2950
Assertions.assertEquals(175, repository.getConstants().getMisc().getRainbowNames().size());
3051
Assertions.assertEquals("Private Island", repository.getConstants().getMisc().getAreaNames().get("dynamic"));
3152
Assertions.assertEquals(12, repository.getConstants().getMisc().getMaxMinionLevel().get("BLAZE_GENERATOR"));
3253
Assertions.assertEquals("100000", repository.getConstants().getMisc().getSlayerCost().get(4));
3354
Assertions.assertEquals("MVP", repository.getConstants().getMisc().getRanks().get("SUPERSTAR").getTag());
3455
Assertions.assertEquals("[CANDY_RING, CANDY_ARTIFACT, CANDY_RELIC]", repository.getConstants().getMisc().getTalismanUpgrades().get("CANDY_TALISMAN").toString());
3556
Assertions.assertEquals(31, repository.getConstants().getMisc().getCredits().getLore().size());
57+
}
58+
59+
@Test
60+
void testConstants() {
3661
Assertions.assertEquals("{magic_find=5.0}", repository.getConstants().getBonuses().getPetRewards(115).toString());
3762
Assertions.assertEquals("{damage_increase=2.0999992, crit_chance=30.0}", repository.getConstants().getBonuses().getAccumulativeLevelingRewards("skill_combat", 60).toString());
3863
Assertions.assertEquals("Optional[PERFECT_AMETHYST_GEM]", repository.getConstants().getParents().getParent("FLAWED_AMETHYST_GEM").toString());
@@ -41,37 +66,37 @@ public void test() throws NEURepositoryException {
4166
Assertions.assertEquals("EssenceCosts.EssenceCost(type=Crimson, essenceCosts={1=170, 2=190, 3=215, 4=240, 5=270, 6=300, 7=340, 8=390, 9=440, 10=500}, itemCosts={4=[§610,000 Coins], 5=[§625,000 Coins], 6=[§650,000 Coins], 7=[§6100,000 Coins], 8=[§6Heavy Pearl §8x3, §6250,000 Coins], 9=[§6Heavy Pearl §8x4, §6500,000 Coins], 10=[§6Heavy Pearl §8x5, §61,000,000 Coins]})", repository.getConstants().getEssenceCost().getCosts().get("HOT_CRIMSON_HELMET").toString());
4267
Assertions.assertEquals("Coordinate(x=138, y=66, z=129)", repository.getConstants().getFairySouls().getSoulLocations().get("hub").get(0).toString());
4368
Assertions.assertEquals(247, repository.getConstants().getFairySouls().getMaxSouls());
69+
}
70+
71+
@Test
72+
void testItems() {
4473
Assertions.assertEquals("minecraft:diamond_sword", repository.getItems().getItemBySkyblockId("ASPECT_OF_THE_END").getMinecraftItemId());
4574
Assertions.assertFalse(repository.getItems().getItemBySkyblockId("ASPECT_OF_THE_END").isVanilla());
4675
Assertions.assertTrue(repository.getItems().getItemBySkyblockId("DIAMOND").isVanilla());
76+
}
77+
78+
@Test
79+
void testRecipes() {
4780
Assertions.assertEquals("[NEUIngredient{TITANIUM_DRILL_4:1.000000}, NEUIngredient{SKYBLOCK_COIN:50000000.000000}, NEUIngredient{DIVAN_ALLOY:1.000000}]", ((NEUForgeRecipe) recipes.getRecipes().get("DIVAN_DRILL").stream().filter(NEUForgeRecipe.class::isInstance).findAny().get()).getInputs().toString());
4881
Assertions.assertEquals(864000, ((NEUKatUpgradeRecipe) recipes.getRecipes().get("BAL;4").stream().filter(NEUKatUpgradeRecipe.class::isInstance).findAny().get()).getSeconds());
4982

50-
int expTotal = 235268;
51-
int expLeft = expTotal;
52-
int level = 0;
53-
for (int expRequiredForThisLevel : repository.getConstants().getLeveling().getSkillExperienceRequiredPerLevel()) {
54-
if (expLeft > expRequiredForThisLevel) {
55-
level++;
56-
expLeft -= expRequiredForThisLevel;
57-
}
58-
}
59-
Assertions.assertEquals(235268, expTotal);
60-
Assertions.assertEquals(18, level);
61-
Assertions.assertEquals(12843, expLeft);
62-
63-
6483
Assertions.assertEquals("[x8-15, x10-18, x2-3, x8-15, x8-15, x3, x1-2, x0-2, x0-3, x5-6, x0-6, x0-3, x30-32, x2, x3-6, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x4-7, x8-15, x1-3, x1-3, x1-2, x1-2, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x8-15, x8-15, §aUnommon 20%, x1, x-10, x1-3, §a20%, §a10%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x2-4, x2-3, x1-3, x1-4, x1-2, x8-15, x8-15, 5% per Hit, 5% per Hit, 4.5% per Hit, 0.0126% per Hit, 0.0054% per Hit, x1-2, x1-2, x2-3, x8-15, x8-15, x1-3, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x1-3, x1-2, §fUncommon 25%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x32, x1-2, x1-2, x1-2, x2-3, x5, x1-2, x1-2, x1-2, x10-22, x2, x2-3, x1-3, x15-27, x18-41]", repository.getItems().getItems().values().stream()
6584
.flatMap(it -> it.getRecipes().stream())
66-
.flatMap(it -> {
67-
if (it instanceof NEUMobDropRecipe) {
68-
return ((NEUMobDropRecipe) it).getDrops().stream();
69-
}
70-
return Stream.empty();
71-
})
85+
.filter(NEUMobDropRecipe.class::isInstance)
86+
.flatMap(it -> ((NEUMobDropRecipe) it).getDrops().stream())
7287
.map(NEUMobDropRecipe.Drop::getChance)
7388
.filter(it -> it != null && !it.matches("\\d+(.\\d+)?+%"))
7489
.collect(Collectors.toList()).toString()
7590
);
7691
}
92+
93+
@Test
94+
void testUnknownRecipes() {
95+
Assertions.assertEquals(Collections.emptyList(), repository.getItems().getItems().values().stream()
96+
.flatMap(it -> it.getRecipes().stream())
97+
.filter(NEUUnknownRecipe.class::isInstance)
98+
.map(NEUUnknownRecipe.class::cast)
99+
.collect(Collectors.toList())
100+
);
101+
}
77102
}

0 commit comments

Comments
 (0)