// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBCFortifiedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBC.FortifiedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBCOngoingStateCarvingBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBC.OngoingStateCarvings",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBCOngoingStateCarvingBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCarvingBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state carving boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCarvingBoundary(
			TEXT("validation-ongoing-state-carving-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state carving boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-carving-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state carving boundary must preserve manual-waiver carvings."),
		Boundary.CarvingIds.Contains(TEXT("ongoing-carving/manual-waiver-carving"))
	);
	TestTrue(
		TEXT("The validation ongoing-state carving boundary must preserve the bounded ongoing-state carving surface."),
		Boundary.CarvingSurfaceTags.Contains(TEXT("bounded ongoing-state carving"))
	);
	TestTrue(
		TEXT("The validation ongoing-state carving boundary must preserve the no-generic-ongoing-carving-platform guard."),
		Boundary.CarvingGuardTags.Contains(TEXT("no-generic-ongoing-carving-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state carving boundary must keep generic ongoing carving platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing carving platform ownership"))
	);
	return true;
}

#endif
