From c8cd62468b34a2bb962a007d83d3461b7a2f9eec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9gis=20Blanc?= <regwblanc@gmail.com>
Date: Wed, 16 May 2012 10:11:17 +0200
Subject: [PATCH] write .dot file method

---
 src/main/scala/leon/CallGraph.scala      | 9 +++++++++
 src/main/scala/leon/TestGeneration.scala | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/scala/leon/CallGraph.scala b/src/main/scala/leon/CallGraph.scala
index eaff99e67..a0455a3d3 100644
--- a/src/main/scala/leon/CallGraph.scala
+++ b/src/main/scala/leon/CallGraph.scala
@@ -213,6 +213,15 @@ class CallGraph(val program: Program) {
     res
   }
 
+  def writeDotFile(filename: String) {
+    import java.io.FileWriter
+    import java.io.BufferedWriter
+    val fstream = new FileWriter(filename)
+    val out = new BufferedWriter(fstream)
+    out.write(toDotString)
+    out.close
+  }
+
   //def analyse(program: Program) {
   //  z3Solver.setProgram(program)
   //  reporter.info("Running test generation")
diff --git a/src/main/scala/leon/TestGeneration.scala b/src/main/scala/leon/TestGeneration.scala
index a469ee54c..f78d4fd6a 100644
--- a/src/main/scala/leon/TestGeneration.scala
+++ b/src/main/scala/leon/TestGeneration.scala
@@ -17,7 +17,7 @@ class TestGeneration(reporter: Reporter) extends Analyser(reporter) {
 
   def analyse(program: Program) {
     val callGraph = new CallGraph(program)
-    println(callGraph.toDotString)
+    callGraph.writeDotFile("testgen.dot")
     callGraph.findAllPathes.foreach(path => {
       println("Path is: " + path)
       println("constraint is: " + callGraph.pathConstraint(path))
-- 
GitLab