// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAEMergedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAE.MergedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAEOngoingStateConcordanceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAE.OngoingStateConcordances",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAEOngoingStateConcordanceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateConcordanceBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state concordance boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateConcordanceBoundary(
			TEXT("validation-ongoing-state-concordance-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state concordance boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-concordance-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state concordance boundary must preserve manual-waiver concordances."),
		Boundary.ConcordanceIds.Contains(TEXT("ongoing-concordance/manual-waiver-concordant"))
	);
	TestTrue(
		TEXT("The validation ongoing-state concordance boundary must preserve the bounded ongoing-state concordance surface."),
		Boundary.ConcordanceSurfaceTags.Contains(TEXT("bounded ongoing-state concordance"))
	);
	TestTrue(
		TEXT("The validation ongoing-state concordance boundary must preserve the no-generic-ongoing-concordance-platform guard."),
		Boundary.ConcordanceGuardTags.Contains(TEXT("no-generic-ongoing-concordance-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state concordance boundary must keep generic ongoing concordance platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing concordance platform ownership"))
	);
	return true;
}

#endif
