PkmnLibSharp/PkmnLibSharpTests/Library/GrowthRateTests.cs

27 lines
860 B
C#
Raw Normal View History

2020-05-05 20:40:17 +00:00
using NUnit.Framework;
using PkmnLibSharp.Library.GrowthRates;
namespace PkmnLibSharpTests.Library
{
public class GrowthRateTests
{
[Test]
public void LookupGrowthRate()
{
var gr = new LookupGrowthRate(new uint[] {0, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000});
Assert.AreEqual(400, gr.CalculateExperience(5));
Assert.AreEqual(8, gr.CalculateLevel(750));
gr.Dispose();
}
[Test]
public void ExternGrowthRate()
{
var gr = PkmnLibSharp.Library.GrowthRates.ExternGrowthRate.Create(experience => (byte) (experience / 100),
level => (uint) (level * 100));
Assert.AreEqual(500, gr.CalculateExperience(5));
Assert.AreEqual(7, gr.CalculateLevel(750));
gr.Dispose();
}
}
}