Cleanup 2

This commit is contained in:
Tibo De Peuter 2025-05-09 18:30:18 +02:00
parent a9bb6e0338
commit 3c938749d0
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
22 changed files with 299 additions and 110 deletions

View file

@ -37,7 +37,7 @@ class PreprocessorTests {
@Test
fun `multiple anonymous variables should be unique`() {
val input = CompoundTerm(Atom("foo"), listOf(Variable("_"), Variable("_")))
val input = CompoundTerm("foo", Variable("_"), Variable("_"))
val result = preprocessor.preprocess(input)
@ -68,7 +68,7 @@ class PreprocessorTests {
for (argument in inner.arguments) {
if ((argument as Variable).name != "Name") {
assertTrue(
(argument as Variable).name.matches("_\\d+".toRegex()),
argument.name.matches("_\\d+".toRegex()),
"Expected anonymous variable name, but got ${argument.name}"
)
}
@ -83,27 +83,13 @@ class PreprocessorTests {
test(
mapOf(
Atom("=\\=") to Atom("=\\="),
CompoundTerm(Atom("=\\="), emptyList()) to CompoundTerm(Atom("=\\="), emptyList()),
CompoundTerm("=\\=") to CompoundTerm("=\\="),
Atom("EvaluatesToDifferent") to Atom("EvaluatesToDifferent"),
CompoundTerm(Atom("EvaluatesToDifferent"), emptyList()) to CompoundTerm(
Atom("EvaluatesToDifferent"),
emptyList()
),
CompoundTerm(Atom("=\\="), listOf(Atom("a"))) to CompoundTerm(
Atom("=\\="),
listOf(Atom("a"))
),
CompoundTerm(Atom("=\\="), listOf(Integer(1))) to CompoundTerm(
Atom("=\\="),
listOf(Integer(1))
),
CompoundTerm(Atom("=\\="), listOf(Atom("=\\="))) to CompoundTerm(
Atom("=\\="),
listOf(Atom("=\\="))
),
CompoundTerm(Atom("=\\="), listOf(Integer(1), Integer(2))) to EvaluatesToDifferent(
Integer(1), Integer(2)
)
CompoundTerm("EvaluatesToDifferent") to CompoundTerm("EvaluatesToDifferent"),
CompoundTerm("=\\=", Atom("a")) to CompoundTerm("=\\=", Atom("a")),
CompoundTerm("=\\=", Integer(1)) to CompoundTerm("=\\=", Integer(1)),
CompoundTerm("=\\=", Atom("=\\=")) to CompoundTerm("=\\=", Atom("=\\=")),
CompoundTerm("=\\=", Integer(1), Integer(2)) to EvaluatesToDifferent(Integer(1), Integer(2))
)
)
}
@ -113,7 +99,7 @@ class PreprocessorTests {
test(
mapOf(
Atom("=:=") to Atom("=:="),
CompoundTerm(Atom("=:="), emptyList()) to CompoundTerm(Atom("=:="), emptyList()),
CompoundTerm("=:=") to CompoundTerm("=:="),
Atom("EvaluatesTo") to Atom("EvaluatesTo"),
CompoundTerm(Atom("EvaluatesTo"), emptyList()) to CompoundTerm(
Atom("EvaluatesTo"),