TestSolver

The main, comprehensive conformance suite for a Solver implementation: control-flow constructs (conjunction, disjunction, if-then(-else), cut, call/1, catch/3, not/\+), timeouts, side effects (assert, write, standard output, findall/3), and a battery of classic Prolog examples (search trees, backtracking, recursive list processing, term ordering, etc.) drawn from PrologStandardExampleTheories and TestingClauseTheories.

Packaging it here lets every Solver implementation run the very same test cases without re-authoring or duplicating them: a concrete :solve-classic/:solve-streams/:solve-concurrent module declares a commonTest class implementing both this interface and its own SolverFactory, obtains a prototype via TestSolver.prototype, and delegates each overridden test method to it, e.g.:

class TestClassicSolver : TestSolver, SolverFactory by ClassicSolverFactory {
private val prototype = TestSolver.prototype(this)

@Test
override fun testTrue() = prototype.testTrue()
// ... one such override per test method declared here
}

(see TestClassicSolver in :solve-classic for the full example). Because callErrorSignature, nafErrorSignature and notErrorSignature differ slightly across implementations (e.g. whether not/1 or \+/1 is used to report an error), they are supplied as constructor parameters to prototype rather than hard-coded.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The Signature expected in errors raised while resolving a goal through call/1.

Link copied to clipboard

A long test max duration, four times mediumDuration; used for queries involving deeper search or recursion.

Link copied to clipboard

A medium test max duration, twice shortDuration; used for queries involving a handful of resolution steps.

Link copied to clipboard

The Signature expected in errors raised while resolving a goal through \+/1 (negation as failure).

Link copied to clipboard

The Signature expected in errors raised while resolving a goal through not/1.

Link copied to clipboard

A short test max duration, used for queries expected to resolve almost immediately.

Functions

Link copied to clipboard
abstract fun testAppend()
Link copied to clipboard
abstract fun testAssert()
Link copied to clipboard
abstract fun testAssertA()
Link copied to clipboard
abstract fun testAssertRules()
Link copied to clipboard
abstract fun testAssertZ()
Link copied to clipboard
abstract fun testBasicBacktracking1()
Link copied to clipboard
abstract fun testBasicBacktracking2()
Link copied to clipboard
abstract fun testBasicBacktracking3()
Link copied to clipboard
abstract fun testBasicBacktracking4()
Link copied to clipboard
abstract fun testBuiltinApi()

Test presence of correct built-ins

Link copied to clipboard
Link copied to clipboard

A test in which all testing goals are called through the Call primitive

Link copied to clipboard
Link copied to clipboard

A test in which all testing goals are called through the Catch primitive

Link copied to clipboard
abstract fun testConjunction()
Link copied to clipboard
Link copied to clipboard

A test with all goals used in conjunction with true or fail to test Conjunction properties

Link copied to clipboard
Link copied to clipboard
abstract fun testDisjunction()
Link copied to clipboard
Link copied to clipboard
abstract fun testFailure()
Link copied to clipboard
abstract fun testFindAll()
Link copied to clipboard
abstract fun testFunctor()
Link copied to clipboard
abstract fun testHaltPrimitive()

Halt primitive testing with haltTestingGoalsToSolutions

Link copied to clipboard
abstract fun testIfThen1()
Link copied to clipboard
abstract fun testIfThen2()
Link copied to clipboard
abstract fun testIfThenElse1()
Link copied to clipboard
abstract fun testIfThenElse2()
Link copied to clipboard
abstract fun testIfThenElseRule()

If-Then-Else rule testing with ifThenElseStandardExampleNotableGoalToSolution

Link copied to clipboard
Link copied to clipboard
abstract fun testMember()
Link copied to clipboard
abstract fun testNatural()
Link copied to clipboard
abstract fun testNotModularity()

A test in which all testing goals are called through the Not rule

Link copied to clipboard
Link copied to clipboard
abstract fun testRetract()
Link copied to clipboard
abstract fun testRetractAll()
Link copied to clipboard
abstract fun testStandardOutput()
Link copied to clipboard
abstract fun testTermGreaterThan()
Link copied to clipboard
Link copied to clipboard
abstract fun testTermLowerThan()
Link copied to clipboard
Link copied to clipboard
abstract fun testTermNotSame()
Link copied to clipboard
abstract fun testTermSame()
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract fun testTrue()

Test true goal

Link copied to clipboard
Link copied to clipboard
abstract fun testUniv()
Link copied to clipboard
abstract fun testUnknownFlag1()
Link copied to clipboard
abstract fun testUnknownFlag2()
Link copied to clipboard
abstract fun testWrite()