Fixes some potential memory leaks in unit tests, cleanup
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-09-23 20:18:52 +02:00
parent 2b6b3a40ed
commit 4588b2da10
7 changed files with 29 additions and 20 deletions

View File

@@ -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);