- Projekt mit Unity 6.3 LTS (6000.3.20f1, Personal) geöffnet: ProjectSettings, .meta-Dateien, URP-Global-Settings, packages-lock.json. - Manifest auf die benötigten Pakete zurückgeführt; Unity hatte beim ersten Öffnen Vorlagenpakete ergänzt (Purchasing, Analytics, Collab, XR, 2D, Navigation). - Test Runner: Die U1-Suiten laufen unverändert als EditMode-Tests; mit LUNE_TEST_REPORT schreiben .NET und Unity dasselbe JSON-Protokoll (SuiteReport). - Golden-Vergleich zusätzlich je Fachbereich (Gold, HP, Positionen, Türme, Ancients, Wellen, Helden, Boss, Gewinner, ...). Nur Bericht; Testwerte und Prüfungsanzahl unverändert. - Diagnose: FloatProbe (Kern-Arithmetik gegen Godot-Bits und Auswertungsart der Laufzeit), DivergenceTrace und tools/port/trace_diff.py (erster abweichender Schritt), CoreBenchmark für .NET und Editor, CoreBatch als -executeMethod-Einstieg. - .NET-Harness baut nach tools/out/, weil Unity Temp/ beim Beenden löscht. - .gitignore ignoriert nur noch die csproj/sln im Projektwurzelverzeichnis; die Projektdateien des .NET-Harness fehlten deshalb in U1 und kommen jetzt dazu. Stand dieses Commits im Unity-Editor (Mono): 4 von 5 Suiten grün; golden 152/157, weil Mono float32-Zwischenwerte doppelt genau rechnet (Teil 2/2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
3.2 KiB
C#
67 lines
3.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using System.IO;
|
|
|
|
namespace Luneraria.Core.Tests
|
|
{
|
|
/// <summary>
|
|
/// Console runner: dotnet run --project tools/dotnet/Luneraria.Core.Tests -- [suite ...]
|
|
/// Writes the JSON protocol to $LUNE_TEST_REPORT (if set) and exits non-zero on any failure.
|
|
/// Diagnostics: --float-probe out.json, --trace-mirror out.txt, --image scenario label out.png.
|
|
/// </summary>
|
|
public static class Program
|
|
{
|
|
public static int Main(string[] args)
|
|
{
|
|
string root = FindRoot();
|
|
string golden = Path.Combine(root, "Assets/Luneraria/Tests/Core/Golden");
|
|
if (args.Length == 4 && args[0] == "--image")
|
|
return ReplayImage.Write(golden, args[1], args[2], Path.GetFullPath(args[3]));
|
|
if (args.Length == 2 && args[0] == "--trace-mirror")
|
|
{
|
|
// Scenario mirror_match of Golden/scenarios.json, round 7 (docs/port/U1.5-UNITY.md).
|
|
DivergenceTrace.Write(Path.GetFullPath(args[1]), 3, new[] { "glutpakt", "glutpakt", "glutpakt", "glutpakt", "glutpakt", "glutpakt" }, "verteidigung", 7);
|
|
return 0;
|
|
}
|
|
if (args.Length == 2 && args[0] == "--float-probe")
|
|
{
|
|
string probeRuntime = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
|
|
string json = FloatProbe.Run(golden).ToJson(probeRuntime, probeRuntime + ", Release");
|
|
File.WriteAllText(Path.GetFullPath(args[1]), json);
|
|
Console.Write(json);
|
|
return 0;
|
|
}
|
|
var wanted = new HashSet<string>(args);
|
|
var report = new SuiteReport();
|
|
foreach (CheckSuite suite in CheckSuite.All())
|
|
{
|
|
if (wanted.Count > 0 && !wanted.Contains(suite.Name))
|
|
continue;
|
|
suite.GoldenDirectory = golden;
|
|
var clock = Stopwatch.StartNew();
|
|
bool ok = suite.Run();
|
|
clock.Stop();
|
|
report.Add(suite, clock.Elapsed.TotalSeconds);
|
|
Console.WriteLine("LUNE_U1_{0} {1}: {2} checks; {3} failures ({4:0.0} s)", ok ? "PASS" : "FAIL", suite.Name, suite.Checks, suite.Failures.Count, clock.Elapsed.TotalSeconds);
|
|
foreach (string failure in suite.Failures)
|
|
Console.WriteLine(" FAIL " + failure);
|
|
foreach (string note in suite.Notes)
|
|
Console.WriteLine(" note " + note);
|
|
}
|
|
string runtime = System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription;
|
|
if (SuiteReport.TargetPath != null)
|
|
report.WriteTo(SuiteReport.TargetPath, runtime, runtime + ", Release");
|
|
Console.WriteLine(report.Failures == 0 ? "LUNE_U1_TESTS_OK" : "LUNE_U1_TESTS_FAILED");
|
|
return report.Failures == 0 ? 0 : 1;
|
|
}
|
|
|
|
static string FindRoot()
|
|
{
|
|
string dir = AppContext.BaseDirectory;
|
|
while (dir != null && !Directory.Exists(Path.Combine(dir, "Assets/Luneraria")))
|
|
dir = Path.GetDirectoryName(dir);
|
|
return dir ?? Directory.GetCurrentDirectory();
|
|
}
|
|
}
|
|
}
|