Checkpoint
This commit is contained in:
parent
9db1c66781
commit
724e911a6f
17 changed files with 288 additions and 95 deletions
46
tests/e2e/Examples.kt
Normal file
46
tests/e2e/Examples.kt
Normal 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())
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
package e2e
|
||||
|
||||
class myClass {
|
||||
}
|
Reference in a new issue