2019-09-27 20:22:54 -07:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using FluentAssertions;
|
|
|
|
|
using PKHeX.Core;
|
|
|
|
|
using Xunit;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Tests.Legality
|
|
|
|
|
{
|
|
|
|
|
public class LegalityData
|
|
|
|
|
{
|
|
|
|
|
[Fact]
|
|
|
|
|
public void EvolutionsOrdered() // feebas, see issue #2394
|
|
|
|
|
{
|
|
|
|
|
var trees = typeof(EvolutionTree).GetFields(BindingFlags.Static | BindingFlags.NonPublic);
|
2020-01-12 18:12:31 -08:00
|
|
|
|
var fEntries = typeof(EvolutionTree).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).First(z => z.Name == "Entries");
|
2019-09-27 20:22:54 -07:00
|
|
|
|
foreach (var t in trees)
|
|
|
|
|
{
|
|
|
|
|
var gen = Convert.ToInt32(t.Name[7].ToString());
|
|
|
|
|
if (gen <= 4)
|
|
|
|
|
continue;
|
|
|
|
|
|
2020-12-22 21:24:41 -08:00
|
|
|
|
if (t.GetValue(typeof(EvolutionTree)) is not EvolutionTree fTree)
|
2020-01-12 18:12:31 -08:00
|
|
|
|
throw new ArgumentException(nameof(fTree));
|
2020-12-22 21:24:41 -08:00
|
|
|
|
if (fEntries.GetValue(fTree) is not IReadOnlyList<EvolutionMethod[]> entries)
|
2020-01-12 18:12:31 -08:00
|
|
|
|
throw new ArgumentException(nameof(entries));
|
2019-09-27 20:22:54 -07:00
|
|
|
|
var feebas = entries[(int)Species.Feebas];
|
2022-02-08 18:55:55 -08:00
|
|
|
|
if (feebas.Length == 0)
|
|
|
|
|
continue;
|
2019-09-27 20:22:54 -07:00
|
|
|
|
|
|
|
|
|
var t1 = (EvolutionType)feebas[0].Method;
|
|
|
|
|
var t2 = (EvolutionType)feebas[1].Method;
|
|
|
|
|
|
|
|
|
|
t1.IsLevelUpRequired().Should().BeFalse();
|
|
|
|
|
t2.IsLevelUpRequired().Should().BeTrue();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|