// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistTraining/HyperTwistTrainingRuntimeLibrary.h"

#if WITH_AUTOMATION_TESTS

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJADFusedStateLedgerContractTest,
	"HyperTwist.FirstParty.Validation.PhaseJAD.FusedStateLedgers",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJADFusedStateLedgerContractTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationFusedStateLedgerContract Contract;
	TestTrue(
		TEXT("The validation fused-state ledger contract must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationFusedStateLedgerContract(
			TEXT("validation-fused-state-ledger-contract"),
			Contract
		)
	);
	TestEqual(
		TEXT("The validation fused-state ledger contract id must stay stable."),
		Contract.ContractId,
		TEXT("validation-fused-state-ledger-contract")
	);
	TestTrue(
		TEXT("The validation fused-state ledger contract must preserve benchmark-drift fused entries."),
		Contract.LedgerEntryIds.Contains(TEXT("fused-state-ledger/benchmark-drift-fused"))
	);
	TestTrue(
		TEXT("The validation fused-state ledger contract must preserve the bounded fused-state ledger surface."),
		Contract.LedgerSurfaceTags.Contains(TEXT("bounded fused-state ledger"))
	);
	TestTrue(
		TEXT("The validation fused-state ledger contract must preserve the no-generic-fused-state-platform guard."),
		Contract.FusedGuardTags.Contains(TEXT("no-generic-fused-state-platform guard"))
	);
	TestTrue(
		TEXT("The validation fused-state ledger contract must keep generic fused-state platform ownership excluded."),
		Contract.ExplicitExclusions.Contains(TEXT("generic fused-state platform ownership"))
	);
	return true;
}

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistValidationPhaseJADOngoingStateCoherenceBoundaryTest,
	"HyperTwist.FirstParty.Validation.PhaseJAD.OngoingStateCoherences",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistValidationPhaseJADOngoingStateCoherenceBoundaryTest::RunTest(const FString& Parameters)
{
	FHyperTwistTrainingValidationOngoingStateCoherenceBoundary Boundary;
	TestTrue(
		TEXT("The validation ongoing-state coherence boundary must resolve from the runtime library."),
		UHyperTwistTrainingRuntimeLibrary::TryGetBundledValidationOngoingStateCoherenceBoundary(
			TEXT("validation-ongoing-state-coherence-boundary"),
			Boundary
		)
	);
	TestEqual(
		TEXT("The validation ongoing-state coherence boundary id must stay stable."),
		Boundary.BoundaryId,
		TEXT("validation-ongoing-state-coherence-boundary")
	);
	TestTrue(
		TEXT("The validation ongoing-state coherence boundary must preserve manual-waiver coherences."),
		Boundary.CoherenceIds.Contains(TEXT("ongoing-coherence/manual-waiver-coherent"))
	);
	TestTrue(
		TEXT("The validation ongoing-state coherence boundary must preserve the bounded ongoing-state coherence surface."),
		Boundary.CoherenceSurfaceTags.Contains(TEXT("bounded ongoing-state coherence"))
	);
	TestTrue(
		TEXT("The validation ongoing-state coherence boundary must preserve the no-generic-ongoing-coherence-platform guard."),
		Boundary.CoherenceGuardTags.Contains(TEXT("no-generic-ongoing-coherence-platform guard"))
	);
	TestTrue(
		TEXT("The validation ongoing-state coherence boundary must keep generic ongoing coherence platform ownership excluded."),
		Boundary.ExplicitExclusions.Contains(TEXT("generic ongoing coherence platform ownership"))
	);
	return true;
}

#endif
