feat(prolog): Atom unification
This commit is contained in:
parent
8429733200
commit
39c3af4ba5
5 changed files with 47 additions and 0 deletions
29
tests/prolog/unifyTest.kt
Normal file
29
tests/prolog/unifyTest.kt
Normal file
|
@ -0,0 +1,29 @@
|
|||
package prolog
|
||||
|
||||
import org.junit.jupiter.api.Assertions.*
|
||||
import org.junit.jupiter.api.Test
|
||||
import prolog.terms.Atom
|
||||
|
||||
class unifyTest {
|
||||
@Test
|
||||
fun identical_atoms_unify() {
|
||||
val atom1 = Atom("a")
|
||||
val atom2 = Atom("a")
|
||||
|
||||
val result = unify(atom1, atom2)
|
||||
|
||||
assertTrue(result.success)
|
||||
assertEquals(0, result.substitutions.size)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun different_atoms_do_not_unify() {
|
||||
val atom1 = Atom("a")
|
||||
val atom2 = Atom("b")
|
||||
|
||||
val result = unify(atom1, atom2)
|
||||
|
||||
assertFalse(result.success)
|
||||
assertEquals(0, result.substitutions.size)
|
||||
}
|
||||
}
|
Reference in a new issue