Examples of FunctionDefinition


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

  public void testEmptyFunction() throws Exception {
    TranslationUnit unit = parse(
        "void foo() {                  " +
        "}"
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(1, analyzer.getScore());
  }
View Full Code Here

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

        "void foo() {                  " +
        "  int i = 0;                  " +
        "  i += 1;                     " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(1, analyzer.getScore());
  }
View Full Code Here

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

        "  } else {                    " +
        "    a--;                      " +
        "  }                           " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

        "  if (a < 0) {                " +
        "    a++;                      " +
        "  }                           " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

        "  case 0:                     " +
        "    a = 0;                    " +
        "  }                           " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

        "    a = 1;                    " +
        "    break;                    " +
        "  }                           " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(3, analyzer.getScore());
  }
View Full Code Here

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

        "  default:                    " +
        "    a = 3;                    " +
        "  }                           " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

        "    ++a;                      " +
        "  }                           " +
        "  return a;                   " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

    TranslationUnit unit = parse(
        "int foo(int a, int b) {       " +
        "  return a > 0 ? b : 1;       " +
        "}                             "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(2, analyzer.getScore());
  }
View Full Code Here

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

    TranslationUnit unit = parse(
        "int foo(int a, int b) {                  " +
        "  return a > 0 ? (b < 0 ? -1 : 0) : 1;   " +
        "}                                        "
    );
    FunctionDefinition functionFoo = unit.getChild(0);
    functionFoo.accept(analyzer);
    assertEquals(3, analyzer.getScore());
  }
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.