Exemplo n.º 1
0
  /** Test method for {@link CPSHelper#getFormattedString()}. */
  @Test
  public final void testGetFormattedString() throws FileNotFoundException, nano.ParseException {
    InputStream in1 = new FileInputStream("Example-Nanojava/SimpleSum.java");
    InputStream in2 = new FileInputStream("Example-Nanojava/SimpleSum.java");
    nano.syntaxtree.Node root1 = new NanoJavaParser(in1).Goal();
    nano.syntaxtree.Node root2 = new NanoJavaParser(in2).Goal();

    String code1 = CPSHelper.getFormattedString(root1);
    String code2 = CPSHelper.getFormattedString(root2);

    assertEquals(code1, code2);
  }
Exemplo n.º 2
0
  /** Test method for {@link CPSHelper#getMicroFormattedString()}. */
  @Test
  public final void testGetMicroFormattedString() throws FileNotFoundException, ParseException {
    InputStream in1 = new FileInputStream("Example-Microjava/Factorial.java");
    InputStream in2 = new FileInputStream("Example-Microjava/Factorial.java");
    syntaxtree.Node root1 = new MicroJavaParser(in1).Goal();
    syntaxtree.Node root2 = new MicroJavaParser(in2).Goal();

    String code1 = CPSHelper.getMicroFormattedString(root1);
    String code2 = CPSHelper.getMicroFormattedString(root2);

    assertEquals(code1, code2);
  }
Exemplo n.º 3
0
 /** Assert that node1 and node2 are equal NanoJava nodes. */
 public void assertEqualNanoJavaNodes(nano.syntaxtree.Node expected, nano.syntaxtree.Node actual) {
   assertEquals(CPSHelper.getFormattedString(expected), CPSHelper.getFormattedString(actual));
 }
Exemplo n.º 4
0
 /** Test method for {@link CPSHelper#getMicroJavaNodeFromFile()}. */
 @Test
 public final void testGetMicroJavaNodeFromFileNoException() {
   CPSHelper.getMicroJavaNodeFromFile("Example-Microjava/Factorial.java");
 }
Exemplo n.º 5
0
 /** Assert that node1 and node2 are equal MicroJava nodes. */
 public void assertEqualMicroJavaNodes(Node expected, Node actual) {
   assertEquals(
       CPSHelper.getMicroFormattedString(expected), CPSHelper.getMicroFormattedString(actual));
 }