// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAMCoiledStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAM.CoiledStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAMOngoingStateRepriseBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAM.OngoingStateReprises",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAMOngoingStateRepriseBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRepriseBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state reprise boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRepriseBoundary(
			TEXT("validation-ongoing-state-reprise-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state reprise boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-reprise-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state reprise boundary must preserve manual-waiver reprises."),
		Boundary.RepriseIds.Contains(TEXT("ongoing-reprise/manual-waiver-reprised"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reprise boundary must preserve the bounded ongoing-state reprise surface."),
		Boundary.RepriseSurfaceTags.Contains(TEXT("bounded ongoing-state reprise"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reprise boundary must preserve the no-generic-ongoing-reprise-platform guard."),
		Boundary.RepriseGuardTags.Contains(TEXT("no-generic-ongoing-reprise-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state reprise boundary must keep generic ongoing reprise platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing reprise platform ownership"))
	);
	return true;
}

#endif
