Skip to content

Commit

Permalink
Added more xcfa2c tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leventeBajczi committed Nov 2, 2023
1 parent a601249 commit 68c31ac
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,23 @@ class XcfaCliParseTest {
)
}

@JvmStatic
fun simpleCFiles(): Stream<Arguments> {
return Stream.of(
Arguments.of("/c/litmustest/singlethread/00assignment.c"),
Arguments.of("/c/litmustest/singlethread/01cast.c"),
Arguments.of("/c/litmustest/singlethread/02types.c"),
Arguments.of("/c/litmustest/singlethread/03bitwise.c"),
Arguments.of("/c/litmustest/singlethread/14ushort.c"),
Arguments.of("/c/litmustest/singlethread/15addition.c"),
Arguments.of("/c/litmustest/singlethread/16loop.c"),
Arguments.of("/c/litmustest/singlethread/17recursive.c"),
Arguments.of("/c/litmustest/singlethread/21namecollision.c"),
Arguments.of("/c/litmustest/singlethread/22nondet.c"),
Arguments.of("/c/litmustest/singlethread/23overflow.c"),
)
}

@JvmStatic
fun llvmFiles(): Stream<Arguments> {
return Stream.of(
Expand Down Expand Up @@ -225,4 +242,26 @@ class XcfaCliParseTest {
temp.toFile().deleteRecursively()
}

@ParameterizedTest
@MethodSource("simpleCFiles")
fun testCParseRoundTrip(filePath: String) {
val temp = createTempDirectory()
main(arrayOf(
"--input-type", "C",
"--input", javaClass.getResource(filePath)!!.path,
"--parse-only",
"--stacktrace",
"--output-results",
"--output-directory", temp.toAbsolutePath().toString(),
))
val xcfaC = temp.resolve("xcfa.c").toFile()
main(arrayOf(
"--input-type", "C",
"--input", xcfaC.absolutePath.toString(),
"--parse-only",
"--stacktrace",
))
temp.toFile().deleteRecursively()
}

}

0 comments on commit 68c31ac

Please sign in to comment.