Examples of FunctionDefinition


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

    this.visibility = visibility;
  }

  @Override
  public void functionDirectDeclarator(String name) {
    node = new FunctionDefinition(name, line, parameters, visibility);
    parent.addChild(node);
  }
View Full Code Here

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

    assertEquals("foo", functionFoo.getName());
  }

  public void testEmptyGlobalFunction() throws Exception {
    TranslationUnit unit = parse("void foo() {}");
    FunctionDefinition functionFoo = unit.getChild(0);
    assertEquals("foo", functionFoo.getName());
  }
View Full Code Here

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

  public void testEmptyFunctionInNamespace() throws Exception {
    TranslationUnit unit = parse("namespace A { void foo() {} }");
    Namespace namespaceA = unit.getChild(0);
    assertEquals("A", namespaceA.getName());
    FunctionDefinition functionFoo = namespaceA.getChild(0);
    assertEquals("foo", functionFoo.getName());
  }
View Full Code Here

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

  public void testEmptyMemberFunction() throws Exception {
    TranslationUnit unit = parse("class A { void foo() {} };");
    ClassDeclaration classA = unit.getChild(0);
    assertEquals("A", classA.getName());
    FunctionDefinition functionFoo = classA.getChild(0);
    assertEquals("foo", functionFoo.getName());
    assertEquals(1, functionFoo.getLine());
  }
View Full Code Here

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

  }

  public void testFunctionLineNumbers() throws Exception {
    TranslationUnit unit = parse("class A { void foo() {}\n void\n bar() {} };");
    ClassDeclaration classA = unit.getChild(0);
    FunctionDefinition functionFoo = classA.getChild(0);
    assertEquals(1, functionFoo.getLine());
    FunctionDefinition functionBar = classA.getChild(1);
    assertEquals(3, functionBar.getLine());
  }
View Full Code Here

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

    assertEquals(3, functionBar.getLine());
  }

  public void testSimpleFunction() throws Exception {
    TranslationUnit unit = parse("int foo() { int a = 0; a = a + 1;\n return a; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    assertEquals("foo", functionFoo.getName());
    ReturnStatement returnStatement = functionFoo.getChild(2);
    assertNotNull(returnStatement);
    assertEquals(2, returnStatement.getLineNumber());
  }
View Full Code Here

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

    assertEquals(2, returnStatement.getLineNumber());
  }

  public void testFunctionWithParameters() throws Exception {
    TranslationUnit unit = parse("int foo(int a, int b) { return a + b; }");
    FunctionDefinition functionFoo = unit.getChild(0);
    assertEquals("foo", functionFoo.getName());
    ReturnStatement returnStatement = functionFoo.getChild(0);
    assertNotNull(returnStatement);
    List<ParameterInfo> parameters = functionFoo.getParameters();
    assertEquals(2, parameters.size());
    ParameterInfo parameterA = parameters.get(0);
    assertEquals("a", parameterA.getName());
    assertEquals("int", parameterA.getType().toString());
    ParameterInfo parameterB = parameters.get(1);
View Full Code Here

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

    assertEquals("int", parameterB.getType().toString());
  }

  public void testForStatement() throws Exception {
    TranslationUnit unit = parse("void foo() { for(;;); }");
    FunctionDefinition functionFoo = unit.getChild(0);
    LoopStatement forStatement = functionFoo.getChild(0);
    assertNotNull(forStatement);
  }
View Full Code Here

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

    assertNotNull(forStatement);
  }

  public void testWhileStatement() throws Exception {
    TranslationUnit unit = parse("void foo() { while(true); }");
    FunctionDefinition functionFoo = unit.getChild(0);
    LoopStatement whileStatement = functionFoo.getChild(0);
    assertNotNull(whileStatement);
  }
View Full Code Here

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

    assertNotNull(whileStatement);
  }

  public void testDoStatement() throws Exception {
    TranslationUnit unit = parse("void foo() { do {} while(true); }");
    FunctionDefinition functionFoo = unit.getChild(0);
    LoopStatement doStatement = functionFoo.getChild(0);
    assertNotNull(doStatement);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.