Checkpoint

This commit is contained in:
Tibo De Peuter 2025-05-01 21:16:48 +02:00
parent 9db1c66781
commit 724e911a6f
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
17 changed files with 288 additions and 95 deletions

46
tests/e2e/Examples.kt Normal file
View file

@ -0,0 +1,46 @@
package e2e
import interpreter.FileLoader
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.BeforeEach
import prolog.Program
import java.io.ByteArrayOutputStream
import java.io.PrintStream
class Examples {
private val loader = FileLoader()
@BeforeEach
fun setup() {
Program.reset()
}
@Test
fun fraternity() {
val inputFile = "examples/basics/fraternity.pl"
loader.load(inputFile)
}
@Test
fun unification() {
val inputFile = "examples/basics/unification.pl"
loader.load(inputFile)
}
@Test
fun write() {
val expected = "gpl zegt: dag(wereld)\n"
val outStream = ByteArrayOutputStream()
System.setOut(PrintStream(outStream))
val inputFile = "examples/basics/write.pl"
// Compare the stdio output with the expected output
loader.load(inputFile)
assertEquals(expected, outStream.toString())
}
}

View file

@ -1,4 +0,0 @@
package e2e
class myClass {
}