-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/testing' of gitlab.com:pika-lab/theses/thesis-g…
…reco-aa1920 into feature/testing
- Loading branch information
Showing
16 changed files
with
1,289 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
solve-classic/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestClassicCut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.ClassicSolverFactory | ||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.TestCut | ||
import kotlin.test.Test | ||
|
||
class TestClassicCut: TestCut, SolverFactory by ClassicSolverFactory { | ||
|
||
private val prototype = TestCut.prototype(this) | ||
|
||
@Test | ||
override fun testCut() { | ||
prototype.testCut() | ||
} | ||
|
||
@Test | ||
override fun testCutFailTrue() { | ||
prototype.testCutFailTrue() | ||
} | ||
|
||
@Test | ||
override fun testCallCutFailTrue() { | ||
prototype.testCallCutFailTrue() | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
solve-classic/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestClassicInteger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.* | ||
import it.unibo.tuprolog.solve.channel.InputChannel | ||
import it.unibo.tuprolog.solve.channel.OutputChannel | ||
import it.unibo.tuprolog.solve.exception.PrologWarning | ||
import it.unibo.tuprolog.solve.library.AliasedLibrary | ||
import it.unibo.tuprolog.solve.library.Libraries | ||
import it.unibo.tuprolog.solve.stdlib.DefaultBuiltins | ||
import it.unibo.tuprolog.theory.Theory | ||
import kotlin.test.Test | ||
|
||
class TestClassicInteger : TestInteger, SolverFactory by ClassicSolverFactory { | ||
|
||
private val prototype = TestInteger.prototype(this) | ||
|
||
@Test | ||
override fun testIntPositiveNum() { | ||
prototype.testIntPositiveNum() | ||
} | ||
|
||
@Test | ||
override fun testIntNegativeNum() { | ||
prototype.testIntNegativeNum() | ||
} | ||
|
||
@Test | ||
override fun testIntDecNum() { | ||
prototype.testIntDecNum() | ||
} | ||
|
||
@Test | ||
override fun testIntX() { | ||
prototype.testIntX() | ||
} | ||
|
||
@Test | ||
override fun testIntAtom() { | ||
prototype.testIntAtom() | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
solve-classic/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestClassicNumber.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.ClassicSolverFactory | ||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.TestNumber | ||
import kotlin.test.Test | ||
|
||
class TestClassicNumber : TestNumber, SolverFactory by ClassicSolverFactory { | ||
|
||
private val prototype = TestNumber.prototype(this) | ||
|
||
@Test | ||
override fun testBasicNum() { | ||
prototype.testBasicNum() | ||
} | ||
|
||
@Test | ||
override fun testDecNum() { | ||
prototype.testDecNum() | ||
} | ||
|
||
@Test | ||
override fun testNegNum() { | ||
prototype.testNegNum() | ||
} | ||
|
||
@Test | ||
override fun testLetterNum() { | ||
prototype.testLetterNum() | ||
} | ||
|
||
@Test | ||
override fun testXNum() { | ||
prototype.testXNum() | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
solve-classic/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestClassicTerm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.ClassicSolverFactory | ||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.TestInteger | ||
import it.unibo.tuprolog.solve.TestTerm | ||
import kotlin.test.Test | ||
|
||
class TestClassicTerm : TestTerm, SolverFactory by ClassicSolverFactory { | ||
|
||
private val prototype = TestTerm.prototype(this) | ||
|
||
@Test | ||
override fun testTermDiff() { | ||
prototype.testTermDiff() | ||
} | ||
|
||
@Test | ||
override fun testTermEq() { | ||
prototype.testTermEq() | ||
} | ||
|
||
@Test | ||
override fun testTermGreaterThan() { | ||
prototype.testTermGreaterThan() | ||
} | ||
|
||
@Test | ||
override fun testTermGreaterThanEq() { | ||
prototype.testTermGreaterThanEq() | ||
} | ||
|
||
@Test | ||
override fun testTermLessThan() { | ||
prototype.testTermLessThan() | ||
} | ||
|
||
@Test | ||
override fun testTermLessThanEq() { | ||
prototype.testTermLessThanEq() | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
solve-streams/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestStreamsCut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.StreamsSolverFactory | ||
import it.unibo.tuprolog.solve.TestCut | ||
import kotlin.test.Test | ||
|
||
class TestStreamsCut: TestCut, SolverFactory by StreamsSolverFactory { | ||
|
||
private val prototype = TestCut.prototype(this) | ||
|
||
@Test | ||
override fun testCut() { | ||
prototype.testCut() | ||
} | ||
|
||
@Test | ||
override fun testCutFailTrue() { | ||
prototype.testCutFailTrue() | ||
} | ||
|
||
@Test | ||
override fun testCallCutFailTrue() { | ||
prototype.testCallCutFailTrue() | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
solve-streams/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestStreamsInteger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.* | ||
import it.unibo.tuprolog.solve.channel.InputChannel | ||
import it.unibo.tuprolog.solve.channel.OutputChannel | ||
import it.unibo.tuprolog.solve.exception.PrologWarning | ||
import it.unibo.tuprolog.solve.library.AliasedLibrary | ||
import it.unibo.tuprolog.solve.library.Libraries | ||
import it.unibo.tuprolog.solve.stdlib.DefaultBuiltins | ||
import it.unibo.tuprolog.theory.Theory | ||
import kotlin.test.Test | ||
|
||
class TestStreamsInteger : TestInteger, SolverFactory by StreamsSolverFactory { | ||
|
||
private val prototype = TestInteger.prototype(this) | ||
|
||
@Test | ||
override fun testIntPositiveNum() { | ||
prototype.testIntPositiveNum() | ||
} | ||
|
||
@Test | ||
override fun testIntNegativeNum() { | ||
prototype.testIntNegativeNum() | ||
} | ||
|
||
@Test | ||
override fun testIntDecNum() { | ||
prototype.testIntDecNum() | ||
} | ||
|
||
@Test | ||
override fun testIntX() { | ||
prototype.testIntX() | ||
} | ||
|
||
@Test | ||
override fun testIntAtom() { | ||
prototype.testIntAtom() | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
solve-streams/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestStreamsNumber.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.StreamsSolverFactory | ||
import it.unibo.tuprolog.solve.TestNumber | ||
import kotlin.test.Test | ||
|
||
class TestStreamsNumber : TestNumber, SolverFactory by StreamsSolverFactory { | ||
|
||
private val prototype = TestNumber.prototype(this) | ||
|
||
@Test | ||
override fun testBasicNum() { | ||
prototype.testBasicNum() | ||
} | ||
|
||
@Test | ||
override fun testDecNum() { | ||
prototype.testDecNum() | ||
} | ||
|
||
@Test | ||
override fun testNegNum() { | ||
prototype.testNegNum() | ||
} | ||
|
||
@Test | ||
override fun testLetterNum() { | ||
prototype.testLetterNum() | ||
} | ||
|
||
@Test | ||
override fun testXNum() { | ||
prototype.testXNum() | ||
} | ||
|
||
} |
42 changes: 42 additions & 0 deletions
42
solve-streams/src/commonTest/kotlin/it/unibo/tuprolog/solve/systemtest/TestStreamsTerm.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package it.unibo.tuprolog.solve.systemtest | ||
|
||
import it.unibo.tuprolog.solve.StreamsSolverFactory | ||
import it.unibo.tuprolog.solve.SolverFactory | ||
import it.unibo.tuprolog.solve.TestInteger | ||
import it.unibo.tuprolog.solve.TestTerm | ||
import kotlin.test.Test | ||
|
||
class TestStreamsTerm : TestTerm, SolverFactory by StreamsSolverFactory { | ||
|
||
private val prototype = TestTerm.prototype(this) | ||
|
||
@Test | ||
override fun testTermDiff() { | ||
prototype.testTermDiff() | ||
} | ||
|
||
@Test | ||
override fun testTermEq() { | ||
prototype.testTermEq() | ||
} | ||
|
||
@Test | ||
override fun testTermGreaterThan() { | ||
prototype.testTermGreaterThan() | ||
} | ||
|
||
@Test | ||
override fun testTermGreaterThanEq() { | ||
prototype.testTermGreaterThanEq() | ||
} | ||
|
||
@Test | ||
override fun testTermLessThan() { | ||
prototype.testTermLessThan() | ||
} | ||
|
||
@Test | ||
override fun testTermLessThanEq() { | ||
prototype.testTermLessThanEq() | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
test-solve/src/commonMain/kotlin/it/unibo/tuprolog/solve/TestCut.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package it.unibo.tuprolog.solve | ||
|
||
import it.unibo.tuprolog.solve.SolverTest | ||
|
||
interface TestCut : SolverTest { | ||
companion object { | ||
fun prototype(solverFactory: SolverFactory): TestCut = | ||
TestCutImpl(solverFactory) | ||
} | ||
|
||
/** | ||
* Tests the queries | ||
* ```prolog | ||
* ?- !. | ||
* ``` | ||
* succeeds on a solver initialized with default built-ins and with and empty theory. | ||
*/ | ||
fun testCut() | ||
|
||
/** | ||
* Tests the queries | ||
* ```prolog | ||
* ?- (!,fail;true). | ||
* ``` | ||
* succeeds on a solver initialized with default built-ins and with and empty theory. | ||
*/ | ||
fun testCutFailTrue() | ||
|
||
/** | ||
* Tests the queries | ||
* ```prolog | ||
* ?- (call(!),fail;true). | ||
* ``` | ||
* succeeds on a solver initialized with default built-ins and with and empty theory. | ||
*/ | ||
fun testCallCutFailTrue() | ||
} |
47 changes: 47 additions & 0 deletions
47
test-solve/src/commonMain/kotlin/it/unibo/tuprolog/solve/TestCutImpl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package it.unibo.tuprolog.solve | ||
|
||
import it.unibo.tuprolog.dsl.theory.prolog | ||
|
||
internal class TestCutImpl(private val solverFactory: SolverFactory) : TestCut{ | ||
override fun testCut() { | ||
prolog { | ||
val solver = solverFactory.solverWithDefaultBuiltins() | ||
|
||
val query = atomOf("!") | ||
val solutions = solver.solve(query, mediumDuration).toList() | ||
|
||
assertSolutionEquals( | ||
kotlin.collections.listOf(query.yes()), | ||
solutions | ||
) | ||
} | ||
} | ||
|
||
override fun testCutFailTrue() { | ||
prolog { | ||
val solver = solverFactory.solverWithDefaultBuiltins() | ||
|
||
val query = ("!" and fail or true) | ||
val solutions = solver.solve(query, mediumDuration).toList() | ||
|
||
assertSolutionEquals( | ||
kotlin.collections.listOf(query.no()), | ||
solutions | ||
) | ||
} | ||
} | ||
|
||
override fun testCallCutFailTrue() { | ||
prolog { | ||
val solver = solverFactory.solverWithDefaultBuiltins() | ||
|
||
val query = (call("!") and fail or true ) | ||
val solutions = solver.solve(query, mediumDuration).toList() | ||
|
||
assertSolutionEquals( | ||
kotlin.collections.listOf(query.yes()), | ||
solutions | ||
) | ||
} | ||
} | ||
} |
Oops, something went wrong.