test: Meta examples
This commit is contained in:
parent
1feb3893c5
commit
9b454a9669
5 changed files with 62 additions and 3 deletions
|
@ -37,6 +37,13 @@ class Examples {
|
|||
assertEquals(expected, outStream.toString())
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("meta")
|
||||
fun `Identical output for meta`(inputFile: String, expected: String) {
|
||||
loader.load("examples/meta/$inputFile")
|
||||
assertEquals(expected, outStream.toString())
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("other")
|
||||
fun `Identical output for other`(inputFile: String, expected: String) {
|
||||
|
@ -57,6 +64,10 @@ class Examples {
|
|||
Arguments.of("write.pl", "gpl zegt: dag(wereld)\n"),
|
||||
)
|
||||
|
||||
fun meta() = listOf(
|
||||
Arguments.of("mib_voorbeelden.pl", "b\nf(b)\nf(g(a,a),h(c,d),i(e,f))\nf(g(a,a),h(c,c),i(e,f))\nf(g(a,a),h(c,c),i(e,e))\n")
|
||||
)
|
||||
|
||||
fun other() = listOf(
|
||||
Arguments.of("program.pl", "10\nhello(world)")
|
||||
)
|
||||
|
|
|
@ -32,7 +32,7 @@ class LogicGrammarTests {
|
|||
"male(jimmy).",
|
||||
"female(mary).",
|
||||
"not(not(true)).",
|
||||
"not(a, not(b, c), d, not(not(a)))."
|
||||
"not(a,not(b,c),d,not(not(a)))."
|
||||
])
|
||||
fun `parse simple fact`(input: String) {
|
||||
val result = parser.parseToEnd(input)
|
||||
|
|
|
@ -55,7 +55,7 @@ class IoOperatorsTests {
|
|||
|
||||
assertEquals(1, result.size, "Should return one result")
|
||||
assertTrue(result[0].isSuccess, "Result should be successful")
|
||||
assertEquals("person(john, doe)", outStream.toString().trim(), "Output should match the structure")
|
||||
assertEquals("person(john,doe)", outStream.toString().trim(), "Output should match the structure")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Reference in a new issue