Commit c4c8868a authored by Marcin Moskal's avatar Marcin Moskal
Browse files

Add ((1 x) (2 y) (x) (y 8)) test case

parent 3bf0fb3a
......@@ -126,6 +126,24 @@ class KnowledgeBaseSpec extends FlatSpec with Matchers {
kb.queryAll(Functor(x), Functor(x, Const(1))).toSeq should be(empty)
}
"Query ((1 x) (2 y) (x) (y 8))" should "be unified" in {
val kb = new KnowledgeBase[Int](Set(
Tuple1(2), Tuple1(3), Tuple1(4), (1, 3), (2, 5), Tuple1(4), (2, 2), (2, 8), (7, 8), Tuple1(7),
(1, 4), (1, 8)
))
val x = Variable[Int]("x")
val y = Variable[Int]("y")
kb.queryAll(
Functor(x), Functor(Const(1), x), Functor(Const(2), y), Functor(y, Const(8))
).toSeq should
contain theSameElementsAs Seq(
Set(Variable("x", 3), Variable("y", 2)),
Set(Variable("x", 4), Variable("y", 2))
)
}
"Query ((x) (y) (x y))" should "be unified" ignore {
val kb: KnowledgeBase[Int] = new KnowledgeBase[Int](Set(
Tuple1(2), Tuple1(8), (2, 8), // solution: x = 2, y = 8
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment