Skip to content

Commit

Permalink
remove repeated code in Greco's sources, again
Browse files Browse the repository at this point in the history
  • Loading branch information
gciatto committed Aug 28, 2020
1 parent 03bc5b5 commit dc64d6a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,10 @@ import it.unibo.tuprolog.solve.stdlib.DefaultBuiltins
import it.unibo.tuprolog.theory.Theory
import kotlin.test.Test

class TestClassicNotUnify : TestNotUnify, SolverFactory {
class TestClassicNotUnify : TestNotUnify, SolverFactory by ClassicSolverFactory {

private val prototype = TestNotUnify.prototype(this)

override val defaultBuiltins: AliasedLibrary
get() = DefaultBuiltins

override fun solverOf(
libraries: Libraries,
flags: FlagStore,
staticKb: Theory,
dynamicKb: Theory,
stdIn: InputChannel<String>,
stdOut: OutputChannel<String>,
stdErr: OutputChannel<String>,
warnings: OutputChannel<PrologWarning>
) = Solver.classic(
libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings
)

override fun mutableSolverOf(
libraries: Libraries,
flags: FlagStore,
staticKb: Theory,
dynamicKb: Theory,
stdIn: InputChannel<String>,
stdOut: OutputChannel<String>,
stdErr: OutputChannel<String>,
warnings: OutputChannel<PrologWarning>
) = MutableSolver.classic(
libraries, flags, staticKb, dynamicKb, stdIn, stdOut, stdErr, warnings
)

@Test
override fun testNumberNotUnify() {
prototype.testNumberNotUnify()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
package it.unibo.tuprolog.solve

interface TestNotUnify {
companion object{
interface TestNotUnify : SolverTest {
companion object {
fun prototype(solverFactory: SolverFactory): TestNotUnify =
TestNotUnifyImpl(solverFactory)
TestNotUnifyImpl(solverFactory)
}

/** A short test max duration */
val shortDuration: TimeDuration
get() = 250L

/** A medium test max duration */
val mediumDuration: TimeDuration
get() = 2 * shortDuration

/** A long test max duration */
val longDuration: TimeDuration
get() = 4 * mediumDuration

/**
* Tests the query
* ```prolog
Expand Down

0 comments on commit dc64d6a

Please sign in to comment.