mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-24 18:44:27 -05:00
Add showdownset -> pkm encounter fetch test case
Test parsing glaceon, input must equal output Test generating encounters for a specific version (exists only on Moon) Test generating encounters for the same version (add handling trainer data to permit Tutors) fixes error in VC generations-present fetch which allowed movesets from generations 3-6 lul exclude negative/invalid gameversions
This commit is contained in:
@@ -12,7 +12,7 @@ public static class EncounterMovesetGenerator
|
||||
/// <summary>
|
||||
/// List of possible <see cref="GameVersion"/> values a <see cref="PKM.Version"/> can have.
|
||||
/// </summary>
|
||||
private static readonly GameVersion[] Versions = ((GameVersion[]) Enum.GetValues(typeof(GameVersion))).Where(z => z < GameVersion.RB).Reverse().ToArray();
|
||||
private static readonly GameVersion[] Versions = ((GameVersion[]) Enum.GetValues(typeof(GameVersion))).Where(z => z < GameVersion.RB && z > 0).Reverse().ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// Gets possible encounters that allow all moves requested to be learned.
|
||||
|
||||
@@ -819,7 +819,7 @@ public static int[] GetGenMovesCheckOrder(PKM pkm)
|
||||
private static int[] GetGenMovesOrderVC(PKM pkm)
|
||||
{
|
||||
// VC case: check transfer games in reverse order (8, 7..) then past games.
|
||||
int[] xfer = GetGenMovesOrder(pkm.Format, pkm.GenNumber);
|
||||
int[] xfer = GetGenMovesOrder(pkm.Format, 7);
|
||||
int[] past = GetGenMovesCheckOrderGB(pkm, pkm.GenNumber);
|
||||
int end = xfer.Length;
|
||||
Array.Resize(ref xfer, xfer.Length + past.Length);
|
||||
|
||||
@@ -83,6 +83,7 @@
|
||||
</Compile>
|
||||
<Compile Include="Saves\MemeCrypto\MemeCryptoTests.cs" />
|
||||
<Compile Include="Saves\SMTests.cs" />
|
||||
<Compile Include="Simulator\ShowdownSetTests.cs" />
|
||||
<Compile Include="Util\DataUtilTests.cs" />
|
||||
<Compile Include="Util\DateUtilTests.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
47
Tests/PKHeX.Tests/Simulator/ShowdownSetTests.cs
Normal file
47
Tests/PKHeX.Tests/Simulator/ShowdownSetTests.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using PKHeX.Core;
|
||||
|
||||
namespace PKHeX.Tests.Simulator
|
||||
{
|
||||
[TestClass]
|
||||
public class ShowdownSetTests
|
||||
{
|
||||
private const string SimulatorParse = "Set Parsing Tests";
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(SimulatorParse)]
|
||||
public void SimulatorGetParse()
|
||||
{
|
||||
var set = new ShowdownSet(SetGlaceonUSUMTutor);
|
||||
Assert.AreEqual(SetGlaceonUSUMTutor, set.Text);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(SimulatorParse)]
|
||||
public void SimulatorGetEncounters()
|
||||
{
|
||||
var set = new ShowdownSet(SetGlaceonUSUMTutor);
|
||||
var pk7 = new PK7 {Species = set.Species, AltForm = set.FormIndex, Moves = set.Moves};
|
||||
var encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves, GameVersion.MN);
|
||||
Assert.IsTrue(!encs.Any());
|
||||
pk7.HT_Name = "PKHeX";
|
||||
encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves, GameVersion.MN);
|
||||
Assert.IsTrue(encs.Any());
|
||||
}
|
||||
|
||||
private const string SetGlaceonUSUMTutor =
|
||||
@"Glaceon (F) @ Assault Vest
|
||||
IVs: 0 Atk
|
||||
EVs: 252 HP / 252 SpA / 4 SpD
|
||||
Ability: Ice Body
|
||||
Level: 100
|
||||
Shiny: Yes
|
||||
Modest Nature
|
||||
- Blizzard
|
||||
- Water Pulse
|
||||
- Shadow Ball
|
||||
- Hyper Voice";
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user