TestDirectives
Conformance tests for directive clauses (:- Goal.), covering dynamic/1, static/1, initialization/1, solve/1, set_flag/2, set_prolog_flag/2, op/3, malformed directives, and directives that fail or raise during theory loading. Shared by every Solver implementation via the TestDirectives.prototype(solverFactory) factory (see TestClassicDirectives in :solve-classic for a concrete usage).
Every test case that loads a directive-bearing theory does so via DirectiveTestsUtils.solverInitializers or DirectiveTestsUtils.solverInitializersWithEventsList, i.e. through all four equivalent ways a theory can end up as a solver's knowledge base (as the static/dynamic theory passed to a factory method, or loaded afterwards into a fresh MutableSolver), since a directive must be honored the same way regardless of how its theory was loaded.
Inheritors
Properties
A long test max duration, four times mediumDuration; used for queries involving deeper search or recursion.
A medium test max duration, twice shortDuration; used for queries involving a handful of resolution steps.
A short test max duration, used for queries expected to resolve almost immediately.
Functions
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.
Tests that a theory containing
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.
Same as testExceptionalInitialization1, but for the solve/1 directive instead of initialization/1.
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.
Same as testFailingInitialization1, but for the solve/1 directive instead of initialization/1.
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.
Tests that a theory containing
Same as testSetFlag2, but using the set_prolog_flag/2 directive instead of set_flag/2.
Same as testInitialization1, but for the solve/1 directive instead of initialization/1.
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.
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).