using System; using System.Collections.Generic; namespace Luneraria.Core.Tests { /// /// A test suite in the style of the Godot reference tests: named checks, counted, failures /// collected with their label. The same suites run in the .NET harness (tools/dotnet) and in /// Unity's Test Runner (Unity/CoreSuiteTests.cs); check counts stay comparable with Godot. /// public abstract class CheckSuite { public int Checks { get; private set; } public readonly List Failures = new List(); public readonly List Notes = new List(); /// Folder with the golden files (Assets/Luneraria/Tests/Core/Golden). public string GoldenDirectory = ""; public abstract string Name { get; } protected abstract void RunChecks(); public bool Run() { Checks = 0; Failures.Clear(); Notes.Clear(); try { RunChecks(); } catch (Exception error) { Failures.Add("EXCEPTION " + error.GetType().Name + ": " + error.Message + "\n" + error.StackTrace); } return Failures.Count == 0; } protected void Check(bool ok, string label) { Checks += 1; if (!ok) Failures.Add(label); } protected void Note(string text) { Notes.Add(text); } public static IList All() { return new List { new ContentSuite(), new CoreRulesSuite(), new M2RulesSuite(), new GoldenSuite(), new DeterminismSuite(), new NetSuite(), new NetRoundsSuite() }; } } }