// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBERampartStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBE.RampartStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBEOngoingStateMarkingBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBE.OngoingStateMarkings",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBEOngoingStateMarkingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateMarkingBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state marking boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateMarkingBoundary(
			TEXT("validation-ongoing-state-marking-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state marking boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-marking-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state marking boundary must preserve manual-waiver markings."),
		Boundary.MarkingIds.Contains(TEXT("ongoing-marking/manual-waiver-marking"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marking boundary must preserve the bounded ongoing-state marking surface."),
		Boundary.MarkingSurfaceTags.Contains(TEXT("bounded ongoing-state marking"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marking boundary must preserve the no-generic-ongoing-marking-platform guard."),
		Boundary.MarkingGuardTags.Contains(TEXT("no-generic-ongoing-marking-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state marking boundary must keep generic ongoing marking platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing marking platform ownership"))
	);
	return true;
}

#endif
