Package-level declarations
Types
Platform-specific tuning knob for TestBigList, which builds and resolves a recursive list of SIZE elements to catch performance regressions or stack-depth issues on deep/large resolutions.
Platform-specific tuning knob for TestBigList, which builds and resolves a recursive list of SIZE elements to catch performance regressions or stack-depth issues on deep/large resolutions.
Platform-specific tuning knob for TestBigList, which builds and resolves a recursive list of SIZE elements to catch performance regressions or stack-depth issues on deep/large resolutions.
Hand-written theories (and their expected goal-to-solutions mappings), covering ->/2, ;/2 and member/2, consumed by TestSolver's testIfThen1/testIfThen2/testIfThenElse1/testIfThenElse2/testMember cases, as an alternative/complement to the standard-manual examples gathered in PrologStandardExampleTheories.
Shared helpers for TestDirectives, covering directive-related behavior (dynamic/1, static/1, initialization/1, solve/1, flag/operator-setting directives, and how a Solver/MutableSolver reacts to loading a theory built from them) that would otherwise require boilerplate repeated across every test case.
Utils singleton that contains dummy instances, to be used when in a test something is not important
Tells TestStaticFactory which of Solver's static factory properties (Solver.classic, Solver.streams, Solver.prolog, Solver.problog) are expected to succeed in the module/platform combination under test.
An object containing the collection of Prolog Standard databases and requests, testing ISO functionality.
Base interface shared by every reusable, solver-agnostic conformance test suite in this module (e.g. TestSolver, TestAbolish, TestFindAll, and so on).
Conformance tests for the (deprecated ISO) abolish/1 built-in, shared by every Solver implementation via the TestAbolish.prototype(solverFactory) factory (see TestClassicAbolish in :solve-classic for a concrete usage).
Conformance tests for , /2 (conjunction, and), shared by every Solver implementation via the TestAnd.prototype(solverFactory) factory (see TestClassicAnd in :solve-classic for a concrete usage).
Conformance tests for the ISO arg/3 built-in, shared by every Solver implementation via the TestArg.prototype(solverFactory) factory (see TestClassicArg in :solve-classic for a concrete usage).
Conformance tests for the ISO arithmetic comparison operators =\=/2, =:=/2, >/2, >=/2, </2 and =</2 (each comparing the evaluated value of its two arithmetic-expression arguments, unlike the term-order operators in TestTerm), shared by every Solver implementation via the TestArith.prototype(solverFactory) factory (see TestClassicArith in :solve-classic for a concrete usage).
Conformance tests for the ISO asserta/1 built-in, shared by every Solver implementation via the TestAssertA.prototype(solverFactory) factory (see TestClassicAssertA in :solve-classic for a concrete usage).
Conformance tests for the ISO assertz/1 built-in, shared by every Solver implementation via the TestAssertZ.prototype(solverFactory) factory (see TestClassicAssertZ in :solve-classic for a concrete usage).
Conformance tests for the ISO atom/1 type-checking built-in, shared by every Solver implementation via the TestAtom.prototype(solverFactory) factory (see TestClassicAtom in :solve-classic for a concrete usage).
Conformance tests for the ISO atom_chars/2 built-in, shared by every Solver implementation via the TestAtomChars.prototype(solverFactory) factory (see TestClassicAtomChars in :solve-classic for a concrete usage).
Concrete implementation of TestAtomChars, instantiated via TestAtomChars.prototype.
Conformance tests for the ISO atom_codes/2 built-in, shared by every Solver implementation via the TestAtomCodes.prototype(solverFactory) factory (see TestClassicAtomCodes in :solve-classic for a concrete usage).
Concrete implementation of TestAtomCodes, instantiated via TestAtomCodes.prototype.
Conformance tests for the ISO atom_concat/3 built-in, shared by every Solver implementation via the TestAtomConcat.prototype(solverFactory) factory (see TestClassicAtomConcat in :solve-classic for a concrete usage).
Concrete implementation of TestAtomConcat, instantiated via TestAtomConcat.prototype.
Conformance tests for the ISO atomic/1 type-checking built-in, shared by every Solver implementation via the TestAtomic.prototype(solverFactory) factory (see TestClassicAtomic in :solve-classic for a concrete usage).
Conformance tests for the ISO atom_length/2 built-in, shared by every Solver implementation via the TestAtomLength.prototype(solverFactory) factory (see TestClassicAtomLength in :solve-classic for a concrete usage).
Concrete implementation of TestAtomLength, instantiated via TestAtomLength.prototype.
Conformance tests for the ISO bagof/3 built-in, shared by every Solver implementation via the TestBagOf.prototype(solverFactory) factory (see TestClassicBagOf in :solve-classic for a concrete usage). Compare with TestSetOf (which additionally sorts and deduplicates results) and TestFindAll (which additionally never fails and does not support the ^/2 existential-quantification operator).
Concrete implementation of TestBagOf, instantiated via TestBagOf.prototype.
A stress test that recursively builds a list of BigListOptions.SIZE elements (via a hand-written biglist/2 predicate) and checks the resulting list is correct, to catch performance regressions or stack-depth issues that only manifest on deep/large resolutions. Shared by every Solver implementation via the TestBigList.prototype(solverFactory) factory (see TestClassicBigList in :solve-classic for a concrete usage). BigListOptions.SIZE is tuned per platform (smaller on JS, where recursion is costlier).
Conformance tests for the ISO call/1 built-in, shared by every Solver implementation via the TestCall.prototype(solverFactory) factory (see TestClassicCall in :solve-classic for a concrete usage).
Conformance tests for the ISO catch/3 and throw/1 built-ins, shared by every Solver implementation via the TestCatchAndThrow.prototype(solverFactory) factory (see TestClassicCatchAndThrow in :solve-classic for a concrete usage).
Conformance tests for the ISO char_code/2 built-in, shared by every Solver implementation via the TestCharCode.prototype(solverFactory) factory (see TestClassicCharCode in :solve-classic for a concrete usage).
Concrete implementation of TestCharCode, instantiated via TestCharCode.prototype.
Conformance tests for the ISO clause/2 built-in, shared by every Solver implementation via the TestClause.prototype(solverFactory) factory (see TestClassicClause in :solve-classic for a concrete usage).
Conformance tests for the ISO compound/1 type-checking built-in, shared by every Solver implementation via the TestCompound.prototype(solverFactory) factory (see TestClassicCompound in :solve-classic for a concrete usage).
Conformance tests for the ISO copy_term/2 built-in, shared by every Solver implementation via the TestCopyTerm.prototype(solverFactory) factory (see TestClassicCopyTerm in :solve-classic for a concrete usage).
Concrete implementation of TestCopyTerm, instantiated via TestCopyTerm.prototype.
Conformance tests for the non-standard get_ephemeral/2, get_durable/2, get_persistent/2, set_ephemeral/2, set_durable/2 and set_persistent/2 built-ins, which read/write the three tiers of it.unibo.tuprolog.solve.data.CustomDataStore attached to a Solver's execution context. Shared by every Solver implementation via the TestCustomData.prototype(solverFactory) factory (see TestClassicCustomData in :solve-classic for a concrete usage).
Concrete implementation of TestCustomData, instantiated via TestCustomData.prototype.
Conformance tests for !/0 (cut), shared by every Solver implementation via the TestCut.prototype(solverFactory) factory (see TestClassicCut in :solve-classic for a concrete usage).
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).
Concrete implementation of TestDirectives, instantiated via TestDirectives.prototype.
Conformance tests for fail/0, plus the unknown flag's effect on resolving an undefined procedure, shared by every Solver implementation via the TestFail.prototype(solverFactory) factory (see TestClassicFail in :solve-classic for a concrete usage).
Conformance tests for the ISO findall/3 built-in, shared by every Solver implementation via the TestFindAll.prototype(solverFactory) factory (see TestClassicFindAll in :solve-classic for a concrete usage). errorSignature is the Signature reported by errors raised while resolving findall's goal argument.
Conformance tests for the current_flag/2 and set_flag/2 built-ins (current_prolog_flag/2 and set_prolog_flag/2 are deprecated aliases kept for ISO naming compatibility), and for the it.unibo.tuprolog.solve.flags.FlagStore they operate on: default values, admissible values, error cases (non-atom names, unbound names/values, out-of-domain values), and the ability to both read and write flags that are not part of the built-in set. Shared by every Solver implementation via the TestFlags.prototype(solverFactory) factory (see TestClassicFlags in :solve-classic for a concrete usage).
Concrete implementation of TestFlags, instantiated via TestFlags.prototype.
Conformance tests for the ISO float/1 type-checking built-in, shared by every Solver implementation via the TestFloat.prototype(solverFactory) factory (see TestClassicFloat in :solve-classic for a concrete usage).
Conformance tests for the ISO functor/3 built-in, shared by every Solver implementation via the TestFunctor.prototype(solverFactory) factory (see TestClassicFunctor in :solve-classic for a concrete usage).
Conformance tests for ->/2 (if-then, without an else branch), shared by every Solver implementation via the TestIfThen.prototype(solverFactory) factory (see TestClassicIfThen in :solve-classic for a concrete usage). See also TestIfThenElse for the combined ->/2 ;/2 (if-then-else) construct.
Conformance tests for the combined ->/2 ;/2 construct (if-then-else), shared by every Solver implementation via the TestIfThenElse.prototype(solverFactory) factory (see TestClassicIfThenElse in :solve-classic for a concrete usage). See also TestIfThen for the plain ->/2 (if-then, without an else branch) construct.
An object containing a collection of notable databases to be used when testing Solver functionality.
Request goals (and their expected Solutions) exercising the standard order of terms comparison operators @</2, @=</2, @>/2, @>=/2, plus the term-variance operators =@=/2 (variant) and \=@=/2 (not variant), used by TestSolver.
Conformance tests for the ISO integer/1 type-checking built-in, shared by every Solver implementation via the TestInteger.prototype(solverFactory) factory (see TestClassicInteger in :solve-classic for a concrete usage).
Conformance tests for the ISO is/2 arithmetic-evaluation built-in, shared by every Solver implementation via the TestIs.prototype(solverFactory) factory (see TestClassicIs in :solve-classic for a concrete usage).
Conformance tests for the ISO nonvar/1 type-checking built-in, shared by every Solver implementation via the TestNonVar.prototype(solverFactory) factory (see TestClassicNonVar in :solve-classic for a concrete usage).
Conformance tests for \+/1 (negation as failure), shared by every Solver implementation via the TestNotProvable.prototype(solverFactory) factory (see TestClassicNotProvable in :solve-classic for a concrete usage).
Concrete implementation of TestNotProvable, instantiated via TestNotProvable.prototype.
Conformance tests for \=/2 (unifiability check without binding, "does not unify"), shared by every Solver implementation via the TestNotUnify.prototype(solverFactory) factory (see TestClassicNotUnify in :solve-classic for a concrete usage). See also TestUnify for the corresponding =/2 tests.
Conformance tests for the ISO number/1 type-checking built-in, shared by every Solver implementation via the TestNumber.prototype(solverFactory) factory (see TestClassicNumber in :solve-classic for a concrete usage).
Conformance tests for the ISO number_chars/2 built-in, shared by every Solver implementation via the TestNumberChars.prototype(solverFactory) factory (see TestClassicNumberChars in :solve-classic for a concrete usage). See also TestNumberCodes for the analogous built-in working on character codes.
Concrete implementation of TestNumberChars, instantiated via TestNumberChars.prototype.
Conformance tests for the ISO number_codes/2 built-in, shared by every Solver implementation via the TestNumberCodes.prototype(solverFactory) factory (see TestClassicNumberCodes in :solve-classic for a concrete usage). See also TestNumberChars for the analogous built-in working on single-character atoms.
Concrete implementation of TestNumberCodes, instantiated via TestNumberCodes.prototype.
Conformance tests for the ISO once/1 built-in, shared by every Solver implementation via the TestOnce.prototype(solverFactory) factory (see TestClassicOnce in :solve-classic for a concrete usage).
Conformance tests for ;/2 (disjunction, or), shared by every Solver implementation via the TestOr.prototype(solverFactory) factory (see TestClassicOr in :solve-classic for a concrete usage).
Conformance tests exercising recursive rules, both to check that recursion (with backtracking-driven mutable state, and deep tail recursion) actually resolves correctly, and that it.unibo.tuprolog.solve.flags.LastCallOptimization measurably affects how deep the logic stack trace grows on a failing recursive computation. Shared by every Solver implementation via the TestRecursion.prototype(solverFactory) factory (see TestClassicRecursion in :solve-classic for a concrete usage).
Conformance tests for the ISO repeat/0 built-in, shared by every Solver implementation via the TestRepeat.prototype(solverFactory) factory (see TestClassicRepeat in :solve-classic for a concrete usage).
Conformance tests for the ISO retract/1 built-in's error cases, shared by every Solver implementation via the TestRetract.prototype(solverFactory) factory (see TestClassicRetract in :solve-classic for a concrete usage).
Conformance tests for the ISO setof/3 built-in, shared by every Solver implementation via the TestSetOf.prototype(solverFactory) factory (see TestClassicSetOf in :solve-classic for a concrete usage). Compare with TestBagOf, which does not sort or deduplicate results.
Concrete implementation of TestSetOf, instantiated via TestSetOf.prototype.
Conformance tests for how a Solution's substitution presents variables that only occur nested inside another variable's binding (i.e. do not directly correspond to a variable of the original query), rather than for the resolution logic itself. Shared by every Solver implementation via the TestSolutionPresentation.prototype(solverFactory) factory (see TestClassicSolutionPresentation in :solve-classic for a concrete usage).
Concrete implementation of TestSolutionPresentation, instantiated via TestSolutionPresentation.prototype.
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.
Conformance tests for SolverFactory's two construction APIs — the direct solverOf/mutableSolverOf/ solverWithDefaultBuiltins/mutableSolverWithDefaultBuiltins factory methods, and the fluent builder returned by SolverFactory.newBuilder — checking that, in every combination of (empty vs. custom-configured) and (with vs. without default built-ins) and (immutable vs. mutable), the resulting Solver/MutableSolver ends up with exactly the expected libraries, theories, flags, and I/O channels (see Solver.assertHas in TestUtils.kt), and is an instance of the concrete class the caller expects. Shared by every Solver implementation via the TestSolverConstruction.prototype(factory, defaultBuiltins) factory (see TestClassicSolverConstruction in :solve-classic for a concrete usage).
Concrete implementation of TestSolverConstruction, instantiated via TestSolverConstruction.prototype. Holds solverType/mutableSolverType (captured reified by prototype) to assert the runtime class of solvers it builds, and two fixture groups: Dummy (a non-default library/theory/flags/channels configuration used by every "custom" test case) and Default (the configuration every "empty" test case expects a fresh solver to have).
Conformance tests for a resolution exception's logicStackTrace: the sequence of goal Signatures active when the exception was raised, from the innermost failing goal to the top-level query. All test cases share the same three-rule theory foo(X) :- bar(X). bar(X) :- baz(X). baz(X) :- <errorExpression>., varying only the innermost <errorExpression> and the query wrapping foo(X). Shared by every Solver implementation via the TestStackTrace.prototype(solverFactory) factory (see TestClassicStackTrace in :solve-classic for a concrete usage).
Concrete implementation of TestStackTrace, instantiated via TestStackTrace.prototype.
Conformance tests for Solver.classic/Solver.streams/Solver.prolog/Solver.problog, the static factory properties on Solver's companion object that locate a concrete SolverFactory implementation at runtime (via a service-loading mechanism) without the caller needing a compile-time dependency on the implementing module. Since a given caller module only bundles some of those implementations, which ones are expected to succeed vs. fail is passed in as an Expectations instance rather than hard-coded. Instantiated (not via a solverFactory, unlike every other TestXxx interface in this module) via TestStaticFactory.prototype(expectations); see SolveClassicTest/SolveConcurrentTest (in :solve-classic/:solve-concurrent) for concrete usages.
Concrete implementation of TestStaticFactory, instantiated via TestStaticFactory.prototype.
Conformance tests for the ISO sub_atom/5 built-in (sub_atom(Atom, Before, Length, After, SubAtom)), shared by every Solver implementation via the TestSubAtom.prototype(solverFactory) factory (see TestClassicSubAtom in :solve-classic for a concrete usage).
Concrete implementation of TestSubAtom, instantiated via TestSubAtom.prototype.
Conformance tests for how a resolved Solution's substitution treats variables that do not directly appear in the original query ("uninteresting" variables, introduced only by intermediate goals/clause bodies), and for the it.unibo.tuprolog.solve.flags.TrackVariables flag that controls whether they are kept visible to a custom primitive during resolution. Shared by every Solver implementation via the TestSubstitutions.prototype(solverFactory) factory (see TestClassicSubstitutions in :solve-classic for a concrete usage).
Concrete implementation of TestSubstitutions, instantiated via TestSubstitutions.prototype.
Verifies that term tags (see it.unibo.tuprolog.utils.Taggable) attached to a theory's clauses, or to a query, survive resolution and are visible to a custom it.unibo.tuprolog.unify.Unificator.
Concrete implementation of TestTagsPreservationDuringResolution, instantiated via TestTagsPreservationDuringResolution.prototype.
Conformance tests for the ISO standard order of terms comparison operators \==/2, ==/2, @>/2, @>=/2, @</2 and @=</2 (each comparing their two arguments as terms, without arithmetic evaluation, unlike the arithmetic comparisons in TestArith), shared by every Solver implementation via the TestTerm.prototype(solverFactory) factory (see TestClassicTerm in :solve-classic for a concrete usage).
Conformance tests for Solver.solve(goal, maxDuration)'s timeout enforcement: checking that a computation exceeding its allotted it.unibo.tuprolog.solve.TimeDuration halts with a it.unibo.tuprolog.solve.exception.TimeOutException, both for a plainly slow goal (sleep/1) and for non-terminating all-solutions collectors (findall/3, bagof/3, setof/3) fed by an infinite generator. Shared by every Solver implementation via the TestTimeout.prototype(solverFactory) factory (see TestClassicTimeout in :solve-classic for a concrete usage).
Concrete implementation of TestTimeout, instantiated via TestTimeout.prototype.
Conformance tests for true/0, shared by every Solver implementation via the TestTrue.prototype(solverFactory) factory (see TestClassicTrue in :solve-classic for a concrete usage).
Conformance tests for =/2 (unification), shared by every Solver implementation via the TestUnify.prototype(solverFactory) factory (see TestClassicUnify in :solve-classic for a concrete usage). See also TestNotUnify for the corresponding \=/2 tests.
A theory whose resolution takes a predictable amount of time (via nested sleep/1 calls), and the expected Solutions of resolving it against maximum durations that fall just below/above each of its timing thresholds; used by TestSolver to check that a Solver.solve(goal, maxDuration) call's timeout is honored as soon as it is exceeded, without waiting for the whole (deeper) computation to finish first.
Functions
Asserts that klass's runtime name matches the expected name. Comparison is platform-specific because Kotlin/JS does not preserve fully qualified class names: the JVM actual compares klass's qualified name against name verbatim, while the JS actual compares only the last, dot-separated segment of name against klass's simple name.
Asserts that klass's runtime name matches the expected name. Comparison is platform-specific because Kotlin/JS does not preserve fully qualified class names: the JVM actual compares klass's qualified name against name verbatim, while the JS actual compares only the last, dot-separated segment of name against klass's simple name.
Asserts that klass's runtime name matches the expected name. Comparison is platform-specific because Kotlin/JS does not preserve fully qualified class names: the JVM actual compares klass's qualified name against name verbatim, while the JS actual compares only the last, dot-separated segment of name against klass's simple name.
Asserts that the receiver Solver was built with exactly the given libraries, staticKb, dynamicKb, flags, inputs and outputs, used by TestSolverConstruction to check a Solver/MutableSolver built via either SolverFactory.solverOf-style factory methods or the builder API ends up with the expected configuration.
Asserts that the receiver Solver's API (Solver.libraries) exposes a predicate matching signature.
Asserts that the receiver Solver's API (Solver.libraries) exposes primitive (a primitive built-in).
Asserts that the receiver Solver's API (Solver.libraries) exposes rule (a rule-based built-in predicate).
Asserts that the receiver Solver's API (Solver.libraries) exposes a predicate functor/arity.
Utility function to assert assertion over thrown exception by throwExpression
Utility method to assert that two Solutions are equals, with some exceptions.
Utility method to assert that two solution iterables are equal by means of given equalityAssertion, called for each expected-actual solution pair
Utility method to solve goals in goalToSolutions with solver and check if solutions are as expected by means of assertSolutionEquals
Utility function to help writing tests; applies changeQueryTo to all Solutions in receiver iterable
Utility function to help writing tests; it forwards the copy method call to subclasses changing only the query field
Utility function to help writing tests; it creates a Solution.Halt with receiver query and provided exception
Renders the internal state of the value returned by x for diagnostic logging: toString() on the JVM, JSON.stringify on JS.
Renders the internal state of the value returned by x for diagnostic logging: toString() on the JVM, JSON.stringify on JS.
Renders the internal state of the value returned by x for diagnostic logging: toString() on the JVM, JSON.stringify on JS.
Utility function to log passed goal and solutions
Utility function to help writing tests; it creates a Solution.No with receiver query
Utility function to help writing tests; it creates a Solution.Yes with receiver query and provided substitution