PkmnLibRSharp/PkmnLibRSharpTests/StaticData/StatisticSetTests.cs

105 lines
5.0 KiB
C#

using NUnit.Framework;
using PkmnLibSharp.StaticData;
namespace PkmnLibRSharpTests.StaticData
{
public class StatisticSetTests
{
[Test]
public void ByteStatisticSet([Random(1)] byte hp, [Random(1)] byte attack, [Random(1)] byte defense,
[Random(1)] byte specialAttack, [Random(1)] byte specialDefense, [Random(1)] byte speed)
{
using var set = new StatisticSet<byte>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void ByteStatisticSetModifying([Random(1)] byte hp, [Random(1)] byte attack, [Random(1)] byte defense,
[Random(1)] byte specialAttack, [Random(1)] byte specialDefense, [Random(1)] byte speed)
{
using var set = new StatisticSet<byte>(0,0,0,0,0,0);
set.HP = hp;
Assert.AreEqual(set.HP, hp);
set.Attack = attack;
Assert.AreEqual(set.Attack, attack);
set.Defense = defense;
Assert.AreEqual(set.Defense, defense);
set.SpecialAttack = specialAttack;
Assert.AreEqual(set.SpecialAttack, specialAttack);
set.SpecialDefense = specialDefense;
Assert.AreEqual(set.SpecialDefense, specialDefense);
set.Speed = speed;
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void UShortStatisticSet([Random(1)] ushort hp, [Random(1)] ushort attack, [Random(1)] ushort defense,
[Random(1)] ushort specialAttack, [Random(1)] ushort specialDefense, [Random(1)] ushort speed)
{
using var set = new StatisticSet<ushort>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void UintStatisticSet([Random(1)] uint hp, [Random(1)] uint attack, [Random(1)] uint defense,
[Random(1)] uint specialAttack, [Random(1)] uint specialDefense, [Random(1)] uint speed)
{
using var set = new StatisticSet<uint>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void SbyteStatisticSet([Random(1)] sbyte hp, [Random(1)] sbyte attack, [Random(1)] sbyte defense,
[Random(1)] sbyte specialAttack, [Random(1)] sbyte specialDefense, [Random(1)] sbyte speed)
{
using var set = new StatisticSet<sbyte>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void ShortStatisticSet([Random(1)] short hp, [Random(1)] short attack, [Random(1)] short defense,
[Random(1)] short specialAttack, [Random(1)] short specialDefense, [Random(1)] short speed)
{
using var set = new StatisticSet<short>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
[Test]
public void IntStatisticSet([Random(1)] int hp, [Random(1)] int attack, [Random(1)] int defense,
[Random(1)] int specialAttack, [Random(1)] int specialDefense, [Random(1)] int speed)
{
using var set = new StatisticSet<int>(hp, attack, defense, specialAttack, specialDefense, speed);
Assert.AreEqual(set.HP, hp);
Assert.AreEqual(set.Attack, attack);
Assert.AreEqual(set.Defense, defense);
Assert.AreEqual(set.SpecialAttack, specialAttack);
Assert.AreEqual(set.SpecialDefense, specialDefense);
Assert.AreEqual(set.Speed, speed);
}
}
}