// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBGKeepStatePacketContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJBG.KeepStatePackets",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

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

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJBGOngoingStateNotationBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJBG.OngoingStateNotations",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJBGOngoingStateNotationBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateNotationBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state notation boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateNotationBoundary(
			TEXT("validation-ongoing-state-notation-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state notation boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-notation-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state notation boundary must preserve manual-waiver notations."),
		Boundary.NotationIds.Contains(TEXT("ongoing-notation/manual-waiver-notation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state notation boundary must preserve the bounded ongoing-state notation surface."),
		Boundary.NotationSurfaceTags.Contains(TEXT("bounded ongoing-state notation"))
	);
	TestTrue(
		TEXT("The validation ongoing-state notation boundary must preserve the no-generic-ongoing-notation-platform guard."),
		Boundary.NotationGuardTags.Contains(TEXT("no-generic-ongoing-notation-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state notation boundary must keep generic ongoing notation platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing notation platform ownership"))
	);
	return true;
}

#endif
