// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAIKnottedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAI.KnottedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAIKnottedStatePacketContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationKnottedStatePacketContract Contract;
	TestTrue(
		TEXT("The validation knotted-state packet contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationKnottedStatePacketContract(
			TEXT("validation-knotted-state-packet-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation knotted-state packet contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-knotted-state-packet-contract")
	);
	TestTrue(
		TEXT("The validation knotted-state packet contract must preserve benchmark-drift knotted packets."),
		Contract.PacketIds.Contains(TEXT("knotted-state-packet/benchmark-drift-knotted"))
	);
	TestTrue(
		TEXT("The validation knotted-state packet contract must preserve the bounded knotted-state packet surface."),
		Contract.PacketSurfaceTags.Contains(TEXT("bounded knotted-state packet"))
	);
	TestTrue(
		TEXT("The validation knotted-state packet contract must preserve the no-generic-knotted-state-platform guard."),
		Contract.KnottedGuardTags.Contains(TEXT("no-generic-knotted-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation knotted-state packet contract must keep generic knotted-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic knotted-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAIOngoingStateHarmonicBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAI.OngoingStateHarmonics",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAIOngoingStateHarmonicBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateHarmonicBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state harmonic boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateHarmonicBoundary(
			TEXT("validation-ongoing-state-harmonic-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state harmonic boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-harmonic-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state harmonic boundary must preserve manual-waiver harmonics."),
		Boundary.HarmonicIds.Contains(TEXT("ongoing-harmonic/manual-waiver-harmonic"))
	);
	TestTrue(
		TEXT("The validation ongoing-state harmonic boundary must preserve the bounded ongoing-state harmonic surface."),
		Boundary.HarmonicSurfaceTags.Contains(TEXT("bounded ongoing-state harmonic"))
	);
	TestTrue(
		TEXT("The validation ongoing-state harmonic boundary must preserve the no-generic-ongoing-harmonic-platform guard."),
		Boundary.HarmonicGuardTags.Contains(TEXT("no-generic-ongoing-harmonic-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state harmonic boundary must keep generic ongoing harmonic platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing harmonic platform ownership"))
	);
	return true;
}

#endif
