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

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


  @Override
  public void beginTernaryOperator() {
    int index = nodes.size() - 1;
    Expression name = nodes.get(index);
    nodes.remove(index);
    Node node = new TernaryOperation();
    nodes.add(node);
    node.addExpression(name);
    pushBuilder(new ExpressionBuilder(node));
  }
View Full Code Here


  public void testTernaryOperator() throws Exception {
    TranslationUnit unit = parse("int foo(int a, int b) { return a ? 0 : b; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    ReturnStatement returnStatement = functionFoo.getChild(0);
    TernaryOperation ternaryOperation = returnStatement.getExpression(0);
    assertNotNull(ternaryOperation);
  }
View Full Code Here

  public void testNestedTernaryOperator() throws Exception {
    TranslationUnit unit = parse("int foo(int a, int b) { int c = a ? 0 : (b ? 1 : 2); }");
    FunctionDefinition functionFoo = unit.getChild(0);
    VariableDeclaration variableC = functionFoo.getChild(0);
    TernaryOperation ternaryOperation = variableC.getExpression(0);
    TernaryOperation nestedTernaryOperation = ternaryOperation.getExpression(1);
    assertNotNull(nestedTernaryOperation);
  }
View Full Code Here

TOP

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

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.