Nature Library, Nature wrapper and tests, cleanup to ensure no duplicate enums are visible outside the library.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using NUnit.Framework;
|
||||
using Pkmnlib;
|
||||
using PkmnLibSharp.Library;
|
||||
using PkmnLibSharp.Library.Items;
|
||||
using PkmnLibSharp.Utilities;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using NUnit.Framework;
|
||||
using Pkmnlib;
|
||||
using PkmnLibSharp.Library;
|
||||
using PkmnLibSharp.Library.Items;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using NUnit.Framework;
|
||||
using Pkmnlib;
|
||||
using PkmnLibSharp.Library;
|
||||
using PkmnLibSharp.Library.Moves;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
@@ -9,7 +10,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void ConstructDestruct()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
move.Dispose();
|
||||
}
|
||||
@@ -17,7 +18,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetName()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual("foobar", move.Name);
|
||||
move.Dispose();
|
||||
@@ -26,7 +27,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetType()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(0, move.Type);
|
||||
move.Dispose();
|
||||
@@ -35,7 +36,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetCategory()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(MoveCategory.Physical, move.Category);
|
||||
move.Dispose();
|
||||
@@ -44,7 +45,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetBasePower()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(60, move.BasePower);
|
||||
move.Dispose();
|
||||
@@ -53,7 +54,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetAccuracy()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(100, move.Accuracy);
|
||||
move.Dispose();
|
||||
@@ -62,7 +63,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetBaseUsages()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(20, move.BaseUsages);
|
||||
move.Dispose();
|
||||
@@ -71,16 +72,16 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetTarget()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(AttackTarget.Adjacent, move.Target);
|
||||
Assert.AreEqual(MoveTarget.Adjacent, move.Target);
|
||||
move.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetPriority()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(1, move.Priority);
|
||||
move.Dispose();
|
||||
@@ -89,7 +90,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetEffectChance()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual(0.5f, move.SecondaryEffectChance);
|
||||
move.Dispose();
|
||||
@@ -98,7 +99,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void GetEffectChanceName()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
Assert.AreEqual("test", move.SecondaryEffectName);
|
||||
move.Dispose();
|
||||
@@ -107,11 +108,11 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void HasSecondaryEffect()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
Assert.True(move.HasSecondaryEffect);
|
||||
move.Dispose();
|
||||
move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "", new EffectParameter[0], new string[0]);
|
||||
Assert.False(move.HasSecondaryEffect);
|
||||
move.Dispose();
|
||||
@@ -121,7 +122,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void HasFlag()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new []{"flag1"});
|
||||
Assert.True(move.HasFlag("flag1"));
|
||||
Assert.False(move.HasFlag("flag2"));
|
||||
|
||||
@@ -3,6 +3,7 @@ using NUnit.Framework;
|
||||
using Pkmnlib;
|
||||
using PkmnLibSharp;
|
||||
using PkmnLibSharp.Library;
|
||||
using PkmnLibSharp.Library.Moves;
|
||||
using PkmnLibSharp.Utilities;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
@@ -19,7 +20,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void Insert()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
var library = MoveLibrary.Create(100);
|
||||
library.Insert("foobar", move);
|
||||
@@ -30,7 +31,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void Delete()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
var library = MoveLibrary.Create(100);
|
||||
library.Insert("foobar", move);
|
||||
@@ -43,7 +44,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void Get()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
var library = MoveLibrary.Create(100);
|
||||
library.Insert("foobar", move);
|
||||
@@ -60,7 +61,7 @@ namespace PkmnLibSharpTests.Library
|
||||
[Test]
|
||||
public void TryGet()
|
||||
{
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1,
|
||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||
var library = MoveLibrary.Create(100);
|
||||
library.Insert("foobar", move);
|
||||
|
||||
43
PkmnLibSharpTests/Library/NatureLibraryTests.cs
Normal file
43
PkmnLibSharpTests/Library/NatureLibraryTests.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Library;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
public class NatureLibraryTests
|
||||
{
|
||||
[Test]
|
||||
public void ConstructDestruct()
|
||||
{
|
||||
var nl = new NatureLibrary(0);
|
||||
nl.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LoadNature()
|
||||
{
|
||||
var nl = new NatureLibrary(1);
|
||||
nl.LoadNature("foo", new Nature());
|
||||
nl.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNature()
|
||||
{
|
||||
var nl = new NatureLibrary(1);
|
||||
nl.LoadNature("foo", new Nature(Statistic.SpecialAttack, Statistic.SpecialDefense));
|
||||
Assert.AreEqual(Statistic.SpecialAttack, nl.GetNature("foo").IncreasedStat);
|
||||
nl.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetNatureName()
|
||||
{
|
||||
var nl = new NatureLibrary(1);
|
||||
nl.LoadNature("foo", new Nature(Statistic.SpecialAttack, Statistic.SpecialDefense));
|
||||
var nature = nl.GetNature("foo");
|
||||
Assert.AreEqual("foo", nl.GetNatureName(nature));
|
||||
nl.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
53
PkmnLibSharpTests/Library/NatureTests.cs
Normal file
53
PkmnLibSharpTests/Library/NatureTests.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Library;
|
||||
|
||||
namespace PkmnLibSharpTests.Library
|
||||
{
|
||||
public class NatureTests
|
||||
{
|
||||
[Test]
|
||||
public void ConstructDestruct()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
nature.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetIncreasedStat()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
Assert.AreEqual(Statistic.Attack, nature.IncreasedStat);
|
||||
nature.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetIncreasedModifier()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
Assert.AreEqual(1.1f, nature.IncreasedModifier);
|
||||
nature.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetDecreasedStat()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
Assert.AreEqual(Statistic.Defense, nature.DecreasedStat);
|
||||
nature.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetDecreasedModifier()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
Assert.AreEqual(0.9f, nature.DecreasedModifier);
|
||||
nature.Dispose();
|
||||
}
|
||||
[Test]
|
||||
public void GetStatModifier()
|
||||
{
|
||||
var nature = new Nature(Statistic.Attack, Statistic.Defense);
|
||||
Assert.AreEqual(0.9f, nature.GetStatModifier(Statistic.Defense));
|
||||
Assert.AreEqual(1f, nature.GetStatModifier(Statistic.SpecialAttack));
|
||||
nature.Dispose();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user