Skip to content
Snippets Groups Projects
Commit 8332e01b authored by hansen's avatar hansen
Browse files

update

parent 6dc3d9ec
No related branches found
No related tags found
No related merge requests found
...@@ -43,23 +43,21 @@ public class TestUtil { ...@@ -43,23 +43,21 @@ public class TestUtil {
start.apply(aP); start.apply(aP);
System.out.println(aP.getResultString()); System.out.println(aP.getResultString());
final BParser parser = new BParser("testcase"); final BParser parser = new BParser("testcase");
final Start ppStart = parser.parse(aP.getResultString(), false); final Start ppStart = parser.parse(aP.getResultString(), false);
String result = getTreeAsString(start); String result = getTreeAsString(start);
System.out.println(result); System.out.println(result);
String ppResult = getTreeAsString(ppStart); String ppResult = getTreeAsString(ppStart);
System.out.println(ppResult); System.out.println(ppResult);
System.out.println("-------------------"); System.out.println("-------------------");
assertEquals(result, ppResult); assertEquals(result, ppResult);
// System.out.println(t.getBDefinitions().getDefinitionNames()); // System.out.println(t.getBDefinitions().getDefinitionNames());
} }
public static void compareExpr(String bExpr, String tlaExpr) throws BException{ public static void compareExpr(String bExpr, String tlaExpr)
throws BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
ToolIO.reset(); ToolIO.reset();
Start resultNode = Translator.translateTlaExpression(tlaExpr); Start resultNode = Translator.translateTlaExpression(tlaExpr);
...@@ -73,15 +71,16 @@ public class TestUtil { ...@@ -73,15 +71,16 @@ public class TestUtil {
assertEquals(bAstString, result); assertEquals(bAstString, result);
} }
public static void compareExprIncludingModel(String bExpr, String tlaExpr, String moduleString) throws TLA2BException{ public static void compareExprIncludingModel(String bExpr, String tlaExpr,
String moduleString) throws TLA2BException {
Translator trans = new Translator(moduleString, null); Translator trans = new Translator(moduleString, null);
trans.translate(); trans.translate();
Start result = trans.translateExpression(tlaExpr); Start result = trans.translateExpression(tlaExpr);
// TODO
} }
public static void compare(String bMachine, String tlaModule)
public static void compare(String bMachine, String tlaModule) throws BException, TLA2BException{ throws BException, TLA2BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
String expected = getAstStringofBMachineString(bMachine); String expected = getAstStringofBMachineString(bMachine);
System.out.println(expected); System.out.println(expected);
...@@ -96,15 +95,16 @@ public class TestUtil { ...@@ -96,15 +95,16 @@ public class TestUtil {
System.out.println(aP.getResultString()); System.out.println(aP.getResultString());
final BParser parser = new BParser("testcase"); final BParser parser = new BParser("testcase");
Start ast = parser.parse(aP.getResultString(), false); Start ast = parser.parse(aP.getResultString(), false);
//BParser.printASTasProlog(System.out, new BParser(), new File("./test.mch"), resultNode, false, true, null); // BParser.printASTasProlog(System.out, new BParser(), new
// File("./test.mch"), resultNode, false, true, null);
// System.out.println(result); // System.out.println(result);
assertEquals(expected, result); assertEquals(expected, result);
assertEquals(expected, getTreeAsString(ast)); assertEquals(expected, getTreeAsString(ast));
} }
public static void compare(String bMachine, String tlaModule, String config) throws BException, TLA2BException{ public static void compare(String bMachine, String tlaModule, String config)
throws BException, TLA2BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
String expected = getAstStringofBMachineString(bMachine); String expected = getAstStringofBMachineString(bMachine);
System.out.println(expected); System.out.println(expected);
...@@ -116,7 +116,8 @@ public class TestUtil { ...@@ -116,7 +116,8 @@ public class TestUtil {
resultNode.apply(aP); resultNode.apply(aP);
System.out.println(aP.getResultString()); System.out.println(aP.getResultString());
//BParser.printASTasProlog(System.out, new BParser(), new File("./test.mch"), resultNode, false, true, null); // BParser.printASTasProlog(System.out, new BParser(), new
// File("./test.mch"), resultNode, false, true, null);
String result = getTreeAsString(resultNode); String result = getTreeAsString(resultNode);
System.out.println(result); System.out.println(result);
...@@ -141,8 +142,8 @@ public class TestUtil { ...@@ -141,8 +142,8 @@ public class TestUtil {
parser.parse(aP.getResultString(), false); parser.parse(aP.getResultString(), false);
} }
public static TestTypeChecker typeCheckString(String moduleString)
public static TestTypeChecker typeCheckString(String moduleString) throws FrontEndException, TLA2BException{ throws FrontEndException, TLA2BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
ToolIO.reset(); ToolIO.reset();
TestTypeChecker testTypeChecker = new TestTypeChecker(); TestTypeChecker testTypeChecker = new TestTypeChecker();
...@@ -151,7 +152,8 @@ public class TestUtil { ...@@ -151,7 +152,8 @@ public class TestUtil {
} }
public static TestTypeChecker typeCheckString(String moduleString, String configString) throws FrontEndException, TLA2BException{ public static TestTypeChecker typeCheckString(String moduleString,
String configString) throws FrontEndException, TLA2BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
ToolIO.reset(); ToolIO.reset();
TestTypeChecker testTypeChecker = new TestTypeChecker(); TestTypeChecker testTypeChecker = new TestTypeChecker();
...@@ -159,7 +161,8 @@ public class TestUtil { ...@@ -159,7 +161,8 @@ public class TestUtil {
return testTypeChecker; return testTypeChecker;
} }
public static TestTypeChecker typeCheck(String moduleFileName) throws FrontEndException, TLA2BException{ public static TestTypeChecker typeCheck(String moduleFileName)
throws FrontEndException, TLA2BException {
ToolIO.setMode(ToolIO.TOOL); ToolIO.setMode(ToolIO.TOOL);
ToolIO.reset(); ToolIO.reset();
moduleFileName = moduleFileName.replace('/', FileUtil.separatorChar); moduleFileName = moduleFileName.replace('/', FileUtil.separatorChar);
...@@ -190,5 +193,4 @@ public class TestUtil { ...@@ -190,5 +193,4 @@ public class TestUtil {
return string; return string;
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment