// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJASPleatedStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAS.PleatedStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJASOngoingStateRemnantBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAS.OngoingStateRemnants",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJASOngoingStateRemnantBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateRemnantBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state remnant boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateRemnantBoundary(
			TEXT("validation-ongoing-state-remnant-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state remnant boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-remnant-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state remnant boundary must preserve manual-waiver remnants."),
		Boundary.RemnantIds.Contains(TEXT("ongoing-remnant/manual-waiver-remnant"))
	);
	TestTrue(
		TEXT("The validation ongoing-state remnant boundary must preserve the bounded ongoing-state remnant surface."),
		Boundary.RemnantSurfaceTags.Contains(TEXT("bounded ongoing-state remnant"))
	);
	TestTrue(
		TEXT("The validation ongoing-state remnant boundary must preserve the no-generic-ongoing-remnant-platform guard."),
		Boundary.RemnantGuardTags.Contains(TEXT("no-generic-ongoing-remnant-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state remnant boundary must keep generic ongoing remnant platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing remnant platform ownership"))
	);
	return true;
}

#endif
