Fixes some potential memory leaks in unit tests, cleanup
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -9,9 +9,10 @@ namespace PkmnLibRSharpTests.StaticData
|
||||
[Test]
|
||||
public void BasicTests()
|
||||
{
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) },
|
||||
new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0), new[] { "foo", "bar" }, new[] { "set" },
|
||||
new LearnableMoves(), Array.Empty<string>());
|
||||
using var stats = new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0);
|
||||
using var moves = new LearnableMoves();
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) }, stats,
|
||||
new[] { "foo", "bar" }, new[] { "set" }, moves, Array.Empty<string>());
|
||||
Assert.AreEqual("foobar", form.Name);
|
||||
Assert.AreEqual(0.2f, form.Height, 0.00001f);
|
||||
Assert.AreEqual(5.8f, form.Weight, 0.00001f);
|
||||
@@ -22,7 +23,6 @@ namespace PkmnLibRSharpTests.StaticData
|
||||
Assert.AreEqual("foo", form.Abilities[0]);
|
||||
Assert.AreEqual("bar", form.Abilities[1]);
|
||||
Assert.AreEqual("set", form.HiddenAbilities[0]);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,15 +13,16 @@ namespace PkmnLibRSharpTests.StaticData.Libraries
|
||||
using var lib = new SpeciesLibrary(0);
|
||||
Assert.AreEqual(0, lib.Length);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void CreateAndAdd()
|
||||
{
|
||||
using var lib = new SpeciesLibrary(0);
|
||||
Assert.AreEqual(0, lib.Length);
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) },
|
||||
new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0), new[] { "foo", "bar" }, new[] { "set" },
|
||||
new LearnableMoves(), Array.Empty<string>());
|
||||
using var stats = new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0);
|
||||
using var moves = new LearnableMoves();
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) }, stats,
|
||||
new[] { "foo", "bar" }, new[] { "set" }, moves, Array.Empty<string>());
|
||||
using var species = new Species(10, "testSpecies", 0.2f, "growth", 120, form, Array.Empty<string>());
|
||||
lib.Add("foobar", species);
|
||||
Assert.AreEqual(1, lib.Length);
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace PkmnLibRSharpTests.StaticData
|
||||
[Values] Statistic decreasedStat
|
||||
)
|
||||
{
|
||||
var nature = new Nature(increasedStat, decreasedStat);
|
||||
using var nature = new Nature(increasedStat, decreasedStat);
|
||||
Assert.AreEqual(increasedStat, nature.IncreasedStat);
|
||||
Assert.AreEqual(decreasedStat, nature.DecreasedStat);
|
||||
if (increasedStat == decreasedStat)
|
||||
|
||||
@@ -9,9 +9,10 @@ namespace PkmnLibRSharpTests.StaticData
|
||||
[Test]
|
||||
public void BasicTests()
|
||||
{
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) },
|
||||
new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0), new[] { "foo", "bar" }, new[] { "set" },
|
||||
new LearnableMoves(), Array.Empty<string>());
|
||||
using var stats = new StaticStatisticSet<short>(5, 10, 30, 20, 2, 0);
|
||||
using var moves = new LearnableMoves();
|
||||
using var form = new Form("foobar", 0.2f, 5.8f, 300, new TypeIdentifier[] { new(1), new(2) }, stats,
|
||||
new[] { "foo", "bar" }, new[] { "set" }, moves, Array.Empty<string>());
|
||||
using var species = new Species(10, "testSpecies", 0.2f, "growth", 120, form, Array.Empty<string>());
|
||||
Assert.AreEqual(10, species.Id);
|
||||
Assert.AreEqual("testSpecies", species.Name);
|
||||
|
||||
Reference in New Issue
Block a user