@@ -2,8 +2,10 @@ package io.github.kelvindev15.dsl
2
2
3
3
import io .github .kelvindev15 .prolog .PrologProgram
4
4
import io .github .kelvindev15 .prolog .core .Constant .Atom
5
- import io .github .kelvindev15 .prolog .core .{Constant , Struct , Variable }
5
+ import io .github .kelvindev15 .prolog .core .Goals .Conjunction
6
+ import io .github .kelvindev15 .prolog .core .PrologList .Cons
6
7
import io .github .kelvindev15 .prolog .core .Struct .{Directive , Fact , Rule }
8
+ import io .github .kelvindev15 .prolog .core .{Constant , PrologList , Struct , Variable }
7
9
import io .github .kelvindev15 .prolog .dsl .{DeclarativeDSL , PrologDSL }
8
10
import org .scalatest .funsuite .AnyFunSuite
9
11
import org .scalatest .matchers .should .Matchers
@@ -61,3 +63,13 @@ class TestDeclarativeDSL extends AnyFunSuite with Matchers with PrologDSL with D
61
63
Struct (Atom (" is" ),
62
64
Constant .Numeric (2.5 ), Struct (Atom (" +" ), Variable (" X" ), Variable (" Y" )))))),
63
65
)
66
+
67
+ test(" Setting the goal of a prolog program" ):
68
+ prolog {
69
+ solve {
70
+ && (2 is X + Y , (head(H ) | T ) `=` S )
71
+ }
72
+ }.goal shouldBe Some (Conjunction (
73
+ Struct (Atom (" is" ), Constant .Numeric (2 ), Struct (Atom (" +" ), Variable (" X" ), Variable (" Y" ))),
74
+ Struct (Atom (" =" ), Cons (Variable (" H" ), Variable (" T" )), Variable (" S" ))
75
+ ))
0 commit comments