Update to latest version of pkmnLib.

This commit is contained in:
2021-11-27 11:27:19 +01:00
parent d542e75cd1
commit 382cbf2673
46 changed files with 642 additions and 342 deletions

View File

@@ -1,3 +1,4 @@
using System.Linq;
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Utilities;
@@ -51,7 +52,9 @@ namespace PkmnLibSharpTests.Library
{
var p = new EffectParameter(10);
var ex = Assert.Throws<NativeException>(() => { p.AsString(); });
Assert.AreEqual("[CreatureLibLibrary] - '[CreatureLib_EffectParameter_AsString] [EffectParameter.hpp:50] Cast effect parameter to string, but was Int'", ex.Message);
Assert.AreEqual(
"[CreatureLibLibrary] - '[CreatureLib_EffectParameter_AsString] [EffectParameter.hpp:53] \"Cast effect parameter to string, but was Int\"'",
ex.Message.Split('\n').First());
p.Dispose();
}
}

View File

@@ -1,3 +1,4 @@
using System;
using NUnit.Framework;
using PkmnLibSharp.Library;
@@ -8,16 +9,20 @@ namespace PkmnLibSharpTests.Library
[Test]
public void ConstructDestruct()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
forme.Dispose();
}
[Test]
public void GetName()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual("foo", forme.Name);
forme.Dispose();
}
@@ -25,8 +30,10 @@ namespace PkmnLibSharpTests.Library
[Test]
public void GetHeight()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(1f, forme.Height);
forme.Dispose();
}
@@ -34,8 +41,10 @@ namespace PkmnLibSharpTests.Library
[Test]
public void GetWeight()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(2f, forme.Weight);
forme.Dispose();
}
@@ -43,22 +52,26 @@ namespace PkmnLibSharpTests.Library
[Test]
public void GetBaseExperience()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(100, forme.BaseExperience);
forme.Dispose();
}
[Test]
public void GetTypes()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(0, forme.GetPkmnType(0));
forme.Dispose();
forme = new Forme("foo", 1, 2, 100, new byte[] {0, 1}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
forme = new Forme("foo", 1, 2, 100, new byte[] { 0, 1 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(0, forme.GetPkmnType(0));
Assert.AreEqual(1, forme.GetPkmnType(1));
forme.Dispose();
@@ -67,8 +80,10 @@ namespace PkmnLibSharpTests.Library
[Test]
public void GetStats()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 20, 30, 40, 50, 60, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 20, 30, 40, 50, 60, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual(10, forme.BaseHealth);
Assert.AreEqual(20, forme.BaseAttack);
Assert.AreEqual(30, forme.BaseDefense);
@@ -81,20 +96,23 @@ namespace PkmnLibSharpTests.Library
[Test]
public void GetAbilities()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
Assert.AreEqual("foo", forme.Abilities[0]);
forme.Dispose();
}
[Test]
public void GetHiddenAbilities()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
Assert.AreEqual("bar", forme.HiddenAbilities[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), Array.Empty<string>());
Assert.AreEqual("foo", forme.Abilities[0].Name);
forme.Dispose();
}
[Test]
public void GetHiddenAbilities()
{
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
Assert.AreEqual("bar", forme.HiddenAbilities[0].Name);
forme.Dispose();
}
}
}

View File

@@ -17,9 +17,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
lib.Dispose();
}
@@ -32,9 +33,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var s = lib.SpeciesLibrary;
Assert.AreEqual(species, s);
lib.Dispose();
@@ -49,9 +51,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var s = lib.Settings;
Assert.AreEqual(settings, s);
lib.Dispose();
@@ -66,9 +69,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var m = lib.MoveLibrary;
Assert.AreEqual(moves, m);
lib.Dispose();
@@ -83,9 +87,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var i = lib.ItemLibrary;
Assert.AreEqual(items, i);
lib.Dispose();
@@ -100,9 +105,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var g = lib.GrowthRateLibrary;
Assert.AreEqual(gr, g);
lib.Dispose();
@@ -117,9 +123,10 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var t = lib.TypeLibrary;
Assert.AreEqual(types, t);
lib.Dispose();
@@ -134,13 +141,32 @@ namespace PkmnLibSharpTests.Library
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var n = lib.NatureLibrary;
Assert.AreEqual(natures, n);
lib.Dispose();
}
[Test]
public void GetAbilityLibrary()
{
var settings = new LibrarySettings(100, 4, 4096);
var species = new SpeciesLibrary(10);
var moves = new MoveLibrary(10);
var items = new ItemLibrary(10);
var gr = new GrowthRateLibrary(10);
var types = new TypeLibrary(10);
var abilities = new AbilityLibrary(10);
var natures = new NatureLibrary(10);
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, abilities, natures);
var a = lib.AbilityLibrary;
Assert.AreEqual(abilities, a);
lib.Dispose();
}
}
}

View File

@@ -1,3 +1,4 @@
using System;
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Utilities;
@@ -16,21 +17,28 @@ namespace PkmnLibSharpTests.Library
[Test]
public void Insert()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
var library = new SpeciesLibrary(100);
library.Insert("foobar", species);
Assert.AreEqual(1, library.Count);
library.Dispose();
}
[Test]
public void Delete()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
var library = new SpeciesLibrary(100);
library.Insert("foobar", species);
Assert.AreEqual(1, library.Count);
@@ -38,31 +46,34 @@ namespace PkmnLibSharpTests.Library
Assert.AreEqual(0, library.Count);
library.Dispose();
}
[Test]
public void Get()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
var library = new SpeciesLibrary(100);
library.Insert("foobar", species);
Assert.AreEqual(1, library.Count);
var m = library.Get("foobar");
Assert.AreEqual(m.Name, "testSpecies");
Assert.Throws<NativeException>(() =>
{
library.Get("barfoo");
});
Assert.Throws<NativeException>(() => { library.Get("barfoo"); });
library.Dispose();
}
[Test]
public void TryGet()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
var library = new SpeciesLibrary(100);
library.Insert("foobar", species);
Assert.AreEqual(1, library.Count);
@@ -71,6 +82,5 @@ namespace PkmnLibSharpTests.Library
Assert.False(library.TryGet("barfoo", out species));
library.Dispose();
}
}
}

View File

@@ -1,113 +1,147 @@
using System;
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Utilities;
namespace PkmnLibSharpTests.Library
{
public class SpeciesTests
public class SpeciesTests
{
[Test]
public void ConstructDestruct()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
species.Dispose();
}
[Test]
public void GetId()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.AreEqual(10, species.Id);
species.Dispose();
}
[Test]
public void GetGenderRate()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.AreEqual(0.5f, species.GenderRate);
species.Dispose();
}
[Test]
public void GetCaptureRate()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.AreEqual(100, species.CaptureRate);
species.Dispose();
}
[Test]
public void GetName()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.AreEqual("testSpecies", species.Name);
species.Dispose();
}
}
[Test]
public void GetGrowthRate()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.AreEqual("exponential", species.GrowthRate);
species.Dispose();
}
[Test]
public void HasForme()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.True(species.HasForme("default"));
species.Dispose();
}
[Test]
public void SetForme()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.True(species.HasForme("default"));
forme = new Forme("bar", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
forme = new Forme("bar", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
species.SetForme("bar", forme);
Assert.True(species.HasForme("bar"));
species.Dispose();
}
[Test]
public void GetForme()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
var f = species.GetForme("default");
Assert.AreEqual(forme, f);
Assert.Throws<NativeException>(() =>
{
species.GetForme("non-existing");
});
Assert.Throws<NativeException>(() => { species.GetForme("non-existing"); });
species.Dispose();
}
[Test]
public void TrGetForme()
public void TryGetForme()
{
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
new[] {"bar"}, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[]{"testEggGroup"}, new string[0]);
using var ability1 = new Ability("foo", "foo", Array.Empty<EffectParameter>());
using var ability2 = new Ability("bar", "bar", Array.Empty<EffectParameter>());
var forme = new Forme("foo", 1, 2, 100, new byte[] { 0 }, 10, 10, 10, 10, 10, 10, new[] { ability1 },
new[] { ability2 }, new LearnableMoves(100), new string[0]);
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80, new[] { "testEggGroup" },
new string[0]);
Assert.True(species.TryGetForme("default", out var f));
Assert.AreEqual(forme, f);
Assert.False(species.TryGetForme("non-existing", out f));
species.Dispose();
}
}
}