TestDirectivesImpl

Concrete implementation of TestDirectives, instantiated via TestDirectives.prototype.

Constructors

Link copied to clipboard
constructor(solverFactory: SolverFactory)

Properties

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

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

Functions

Link copied to clipboard
open override fun testDirectiveLoadingQuickly()

Tests that loading, with default built-ins, a theory of DirectiveTestsUtils.bigTheory's default size (40000 facts) completes at all within this suite's test timeout — a basic guard against quadratic-or-worse loading time regressions. Unlike the other test cases here, it does not inspect the resulting solver.

Link copied to clipboard
open override fun testDynamic1()

Tests that a theory containing

Link copied to clipboard
open override fun testExceptionalInitialization1()

Tests that a theory with a single initialization/1 directive whose goal raises an it.unibo.tuprolog.solve.exception.error.InstantiationError (an unbound variable used in an arithmetic expression) still loads, and that exactly one InitializationIssue warning event, mentioning the raised error, is emitted.

Link copied to clipboard
open override fun testExceptionalSolve1()

Same as testExceptionalInitialization1, but for the solve/1 directive instead of initialization/1.

Link copied to clipboard
open override fun testFailingInitialization1()

Tests that a theory with a single initialization/1 directive whose goal always fails still loads (the fact ends up in the appropriate theory), and that exactly one InitializationIssue warning event, mentioning "failure", is emitted.

Link copied to clipboard
open override fun testFailingSolve1()

Same as testFailingInitialization1, but for the solve/1 directive instead of initialization/1.

Link copied to clipboard
open override fun testInitialization1()

Tests that, for a theory containing an initialization/1 directive whose goal writes to the standard output and calls another predicate that also writes, loading the theory (via any of DirectiveTestsUtils.solverInitializers) triggers those writes, in clause order, exactly once each, and that the predicate defined after the last initialization/1 directive remains solvable afterwards.

Link copied to clipboard
open override fun testOp3()

Tests that a theory containing

Link copied to clipboard
open override fun testSetFlag2()

Tests that a theory containing

Link copied to clipboard
open override fun testSetPrologFlag2()

Same as testSetFlag2, but using the set_prolog_flag/2 directive instead of set_flag/2.

Link copied to clipboard
open override fun testSolve1()

Same as testInitialization1, but for the solve/1 directive instead of initialization/1.

Link copied to clipboard
open override fun testStatic1()

Tests that a theory with the same shape as in testDynamic1 but loaded as a solver's dynamic knowledge base ends up with g/1's facts (following the static/1 directive) moved to the static theory, and every other fact (f/1 and h/1) remaining in the dynamic theory; and that loading it into a fresh MutableSolver via loadDynamicKb produces the same split.

Link copied to clipboard
open override fun testWrongDirectives()

Tests that a theory mixing malformed directives (op("a", xfx, "++") with a non-integer priority, op(3, "b", "+++") with a non-atom specifier, set_flag(a, x) with an inadmissible value, and misspelled dinamic/1/statyc/1 directives) with well-formed facts still loads without emitting any writing/warning event, and that the facts end up in the theory (static or dynamic, depending on how it was loaded).