// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAYRidgedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAY.RidgedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAYOngoingStateStampBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAY.OngoingStateStamps",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAYOngoingStateStampBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateStampBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state stamp boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateStampBoundary(
			TEXT("validation-ongoing-state-stamp-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state stamp boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-stamp-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state stamp boundary must preserve manual-waiver stamps."),
		Boundary.StampIds.Contains(TEXT("ongoing-stamp/manual-waiver-stamp"))
	);
	TestTrue(
		TEXT("The validation ongoing-state stamp boundary must preserve the bounded ongoing-state stamp surface."),
		Boundary.StampSurfaceTags.Contains(TEXT("bounded ongoing-state stamp"))
	);
	TestTrue(
		TEXT("The validation ongoing-state stamp boundary must preserve the no-generic-ongoing-stamp-platform guard."),
		Boundary.StampGuardTags.Contains(TEXT("no-generic-ongoing-stamp-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state stamp boundary must keep generic ongoing stamp platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing stamp platform ownership"))
	);
	return true;
}

#endif
