// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJACIntegratedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAC.IntegratedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJACOngoingStateUnificationBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAC.OngoingStateUnifications",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJACOngoingStateUnificationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateUnificationBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state unification boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateUnificationBoundary(
			TEXT("validation-ongoing-state-unification-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state unification boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-unification-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state unification boundary must preserve manual-waiver unifications."),
		Boundary.UnificationIds.Contains(TEXT("ongoing-unification/manual-waiver-unified"))
	);
	TestTrue(
		TEXT("The validation ongoing-state unification boundary must preserve the bounded ongoing-state unification surface."),
		Boundary.UnificationSurfaceTags.Contains(TEXT("bounded ongoing-state unification"))
	);
	TestTrue(
		TEXT("The validation ongoing-state unification boundary must preserve the no-generic-ongoing-unification-platform guard."),
		Boundary.UnificationGuardTags.Contains(TEXT("no-generic-ongoing-unification-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state unification boundary must keep generic ongoing unification platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing unification platform ownership"))
	);
	return true;
}

#endif
