Package com.google.test.metric.cpp.dom

Examples of com.google.test.metric.cpp.dom.ExpressionStatement


    pushBuilder(new ExpressionBuilder(parent));
  }

  @Override
  public void beginExpressionStatement() {
    ExpressionStatement statement = new ExpressionStatement();
    parent.addChild(statement);
    pushBuilder(new ExpressionBuilder(statement));
  }
View Full Code Here


  }

  public void testFunctionCall() throws Exception {
    TranslationUnit unit = parse("void foo(int) {} void bar(int) { foo(5); }");
    FunctionDefinition functionBar = unit.getChild(1);
    ExpressionStatement expressionStatement = functionBar.getChild(0);
    FunctionInvocation callFoo = expressionStatement.getExpression(0);
    assertEquals("foo", callFoo.getName());
  }
View Full Code Here

        "class A { public: void foo() {} };     " +
        "A bar() { A a; return a; }             " +
        "void main() { bar().foo(); }           ");
    FunctionDefinition functionMain = unit.getChild(2);
    assertEquals("main", functionMain.getName());
    ExpressionStatement expressionStatement = functionMain.getChild(0);
    FunctionInvocation callBar = expressionStatement.getExpression(0);
    assertEquals("bar", callBar.getName());
    FunctionInvocation callFoo = callBar.getChild(0);
    assertEquals("foo", callFoo.getName());
    assertEquals(0, callFoo.getChildren().size());
  }
View Full Code Here

    FunctionDefinition functionMain = unit.getChild(0);
    VariableDeclaration variableA = functionMain.getChild(0);
    assertEquals("a", variableA.getName());
    VariableDeclaration variableB = functionMain.getChild(1);
    assertEquals("b", variableB.getName());
    ExpressionStatement statement = functionMain.getChild(2);
    Expression expression = statement.getExpression(0);
    assertTrue(expression instanceof AssignmentExpression);
    AssignmentExpression assignment = (AssignmentExpression) expression;
    Name leftSide = assignment.getExpression(0);
    Name rightSide = assignment.getExpression(1);
    assertEquals("a", leftSide.getIdentifier());
View Full Code Here

TOP

Related Classes of com.google.test.metric.cpp.dom.ExpressionStatement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.