Make moveflags of gen 7 plugin shared statically
This commit is contained in:
		| @@ -4,7 +4,9 @@ using PkmnLib.Dynamic.Libraries; | ||||
| using PkmnLib.Dynamic.Plugins; | ||||
| using PkmnLib.Dynamic.ScriptHandling; | ||||
| using PkmnLib.Dynamic.ScriptHandling.Registry; | ||||
| using PkmnLib.Plugin.Gen7.Common; | ||||
| using PkmnLib.Static.Moves; | ||||
| using PkmnLib.Static.Utils; | ||||
|  | ||||
| namespace PkmnLib.Plugin.Gen7.Tests.DataTests; | ||||
|  | ||||
| @@ -89,6 +91,26 @@ public class MoveDataTests | ||||
|         await Assert.That(test.Library.ScriptResolver.TryResolve(ScriptCategory.Status, status, null, out _)).IsTrue(); | ||||
|     } | ||||
|  | ||||
|     public static IEnumerable<Func<StringKey>> AllMoveFlagsAreIncludedInMoveFlagsData() | ||||
|     { | ||||
|         var library = LibraryHelpers.LoadLibrary(); | ||||
|         var moveLibrary = library.StaticLibrary.Moves; | ||||
|         foreach (var flag in moveLibrary.SelectMany(x => x.Flags).Distinct()) | ||||
|         { | ||||
|             yield return () => flag; | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     private static readonly HashSet<StringKey> CompileTimeMoveFlags = typeof(MoveFlags).GetFields() | ||||
|         .Where(x => x is { IsStatic: true, IsPublic: true } && x.FieldType == typeof(StringKey)) | ||||
|         .Select(x => (StringKey)x.GetValue(null)!).ToHashSet(); | ||||
|  | ||||
|     [Test, MethodDataSource(nameof(AllMoveFlagsAreIncludedInMoveFlagsData))] | ||||
|     public async Task AllMoveFlagsAreIncludedInMoveFlagsClass(StringKey flag) | ||||
|     { | ||||
|         await Assert.That(CompileTimeMoveFlags.Contains(flag)).IsTrue(); | ||||
|     } | ||||
|  | ||||
|     public record HasEitherEffectOrComment(string MoveName, bool HasEffect, bool HasComment) | ||||
|     { | ||||
|         /// <inheritdoc /> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user