PKHeX/Tests/PKHeX.Core.Tests/PKM/HiddenPowerTests.cs
soopercool101 1a1cfbda4a
Fix Hidden Power Power calculations (and add to UI) (#2989)
* Fix broken hidden power power calculation

* Fix broken Gen 2 Hidden Power calculation

* Add parentheses

* WIP UI

* Finalize UI, only show on gens 1-5

* Inline some logic to reduce allocations

* Add unit tests for both hidden power calculation cases

Co-authored-by: Kurt <kaphotics@gmail.com>
2020-09-14 20:06:11 -07:00

28 lines
889 B
C#

using System;
using FluentAssertions;
using PKHeX.Core;
using Xunit;
namespace PKHeX.Tests.PKM
{
public class HiddenPowerTests
{
[Theory]
[InlineData(14, 15, 15, 14, 14, 15, MoveType.Dark, 69, typeof(PK2))]
[InlineData(30, 31, 31, 30, 31, 31, MoveType.Grass, 70, typeof(PK3))]
[InlineData(26, 31, 31, 30, 31, 31, MoveType.Grass, 70, typeof(PK3))]
public void HiddenPowerTest(int h, int a, int b, int c, int d, int s, MoveType type, int power, Type pkmType)
{
var pkm = PKMConverter.GetBlank(pkmType);
pkm.IV_HP = h;
pkm.IV_ATK = a;
pkm.IV_DEF = b;
pkm.IV_SPA = c;
pkm.IV_SPD = d;
pkm.IV_SPE = s;
pkm.HPType.Should().Be((int)type - 1); // no normal type, down-shift by 1
pkm.HPPower.Should().Be(power);
}
}
}