// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBMCrenelStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBM.CrenelStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBMOngoingStateMarginaliaBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBM.OngoingStateMarginalia",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBMOngoingStateMarginaliaBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateMarginaliaBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state marginalia boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateMarginaliaBoundary(
			TEXT("validation-ongoing-state-marginalia-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state marginalia boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-marginalia-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state marginalia boundary must preserve manual-waiver marginalia."),
		Boundary.MarginaliaIds.Contains(TEXT("ongoing-marginalia/manual-waiver-marginalia"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marginalia boundary must preserve the bounded ongoing-state marginalia surface."),
		Boundary.MarginaliaSurfaceTags.Contains(TEXT("bounded ongoing-state marginalia"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marginalia boundary must preserve the no-generic-ongoing-marginalia-platform guard."),
		Boundary.MarginaliaGuardTags.Contains(TEXT("no-generic-ongoing-marginalia-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marginalia boundary must keep generic ongoing marginalia platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing marginalia platform ownership"))
	);
	return true;
}

#endif
