// Copyright HyperTwist, Inc. All Rights Reserved.

#include "Misc/AutomationTest.h"

#include "HyperTwistIPC/HyperTwistSolverOracleLibrary.h"

IMPLEMENT_SIMPLE_AUTOMATION_TEST(
	FHyperTwistSolverOracleVerificationSolvedStateTest,
	"HyperTwist.Solver.Oracle.VerifySolvedState",
	EAutomationTestFlags::EditorContext | EAutomationTestFlags::EngineFilter
)

bool FHyperTwistSolverOracleVerificationSolvedStateTest::RunTest(const FString& Parameters)
{
	const FString SolvedState = TEXT("UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB");

	TestTrue(
		TEXT("An empty move sequence must verify against the solved classic cube state."),
		UHyperTwistSolverOracleLibrary::VerifySolutionWithBrownanOracle(SolvedState, {})
	);

	TestFalse(
		TEXT("A non-empty move sequence must not verify against the solved classic cube state."),
		UHyperTwistSolverOracleLibrary::VerifySolutionWithBrownanOracle(SolvedState, {TEXT("R")})
	);

	TestFalse(
		TEXT("Invalid move notation must fail solver-oracle verification."),
		UHyperTwistSolverOracleLibrary::VerifySolutionWithBrownanOracle(SolvedState, {TEXT("?")})
	);

	return true;
}
