// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAWFlutedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAW.FlutedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJAWOngoingStateMarkBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAW.OngoingStateMarks",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJAWOngoingStateMarkBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateMarkBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state mark boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateMarkBoundary(
			TEXT("validation-ongoing-state-mark-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state mark boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-mark-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state mark boundary must preserve manual-waiver marks."),
		Boundary.MarkIds.Contains(TEXT("ongoing-mark/manual-waiver-mark"))
	);
	TestTrue(
		TEXT("The validation ongoing-state mark boundary must preserve the bounded ongoing-state mark surface."),
		Boundary.MarkSurfaceTags.Contains(TEXT("bounded ongoing-state mark"))
	);
	TestTrue(
		TEXT("The validation ongoing-state mark boundary must preserve the no-generic-ongoing-mark-platform guard."),
		Boundary.MarkGuardTags.Contains(TEXT("no-generic-ongoing-mark-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state mark boundary must keep generic ongoing mark platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing mark platform ownership"))
	);
	return true;
}

#endif
