diff --git a/subprojects/xcfa/xcfa-cli/src/test/java/hu/bme/mit/theta/xcfa/cli/XcfaCliParseTest.kt b/subprojects/xcfa/xcfa-cli/src/test/java/hu/bme/mit/theta/xcfa/cli/XcfaCliParseTest.kt index 4cb12efd10..c639fe37be 100644 --- a/subprojects/xcfa/xcfa-cli/src/test/java/hu/bme/mit/theta/xcfa/cli/XcfaCliParseTest.kt +++ b/subprojects/xcfa/xcfa-cli/src/test/java/hu/bme/mit/theta/xcfa/cli/XcfaCliParseTest.kt @@ -57,6 +57,23 @@ class XcfaCliParseTest { ) } + @JvmStatic + fun simpleCFiles(): Stream { + 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 { return Stream.of( @@ -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() + } + }