Many more tests and fixes
All checks were successful
Build / Build (push) Successful in 3m12s

This commit is contained in:
2026-08-27 17:11:12 +02:00
parent 32b3ef9c4a
commit d2a82b5fe3
204 changed files with 20255 additions and 242 deletions

View File

@@ -0,0 +1,33 @@
using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Tests.DataTests;
/// <summary>
/// Data tests for the Gen7 item library.
/// </summary>
public class ItemDataTests
{
/// <summary>
/// Bulbapedia (Fling): "Fling inflicts damage; the power of the move is determined by the user's held
/// item." Canonical powers from the Fling item table: Iron Ball and Big Nugget 130, Hard Stone and
/// Rare Bone 100, Poison Barb 70, Damp Rock 60, Light Ball 30, Berries (Oran Berry) 10. The
/// <see cref="PkmnLib.Plugin.Gen7.Scripts.Moves.Fling"/> script reads these from the item's
/// "fling_power" additional data, so the data must define them.
/// </summary>
[Test, Arguments("iron_ball", (byte)130), Arguments("big_nugget", (byte)30), Arguments("hard_stone", (byte)100),
Arguments("rare_bone", (byte)100), Arguments("poison_barb", (byte)70), Arguments("damp_rock", (byte)60),
Arguments("light_ball", (byte)30), Arguments("oran_berry", (byte)10)]
public async Task Items_CanonicalFlingItems_DefineFlingPower(string itemName, byte expectedFlingPower)
{
// Arrange
var library = LibraryHelpers.LoadLibrary();
// Act
var found = library.StaticLibrary.Items.TryGet(new StringKey(itemName), out var item);
// Assert
await Assert.That(found).IsTrue();
await Assert.That(item!.TryGetAdditionalData<byte>(new StringKey("flingPower"), out var flingPower)).IsTrue();
await Assert.That(flingPower).IsEqualTo(expectedFlingPower);
}
}