fix: Univ
This commit is contained in:
parent
d50ec0f715
commit
61178cbeac
2 changed files with 40 additions and 19 deletions
|
@ -568,6 +568,23 @@ class AnalysisOperatorsTests {
|
|||
assertEquals(0, result.size, "Expected 0 results")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `univ extra debugging`() {
|
||||
val univ = Univ(
|
||||
Structure("baz", Variable("Foo")),
|
||||
Cons(Variable("Baz"), Cons(Structure("foo", Integer(1)), Empty))
|
||||
)
|
||||
|
||||
val result = univ.satisfy(emptyMap()).toList()
|
||||
|
||||
assertEquals(1, result.size, "Expected 1 result")
|
||||
assertTrue(result[0].isSuccess, "Expected success")
|
||||
val subs = result[0].getOrNull()!!
|
||||
assertEquals(2, subs.size, "Expected 2 substitutions")
|
||||
assertEquals(Atom("baz"), subs[Variable("Baz")], "Expected Baz to be baz")
|
||||
assertEquals(Structure("foo", Integer(1)), subs[Variable("Foo")], "Expected Foo to be foo(1)")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `univ with two vars should throw`() {
|
||||
val univ = Univ(Variable("X"), Variable("Y"))
|
||||
|
|
Reference in a new issue