DD2480-G12 / libphonenumber

Google's common Java, C++ and JavaScript library for parsing, formatting, and validating international phone numbers.
Apache License 2.0
0 stars 0 forks source link

Implement branch coverage for PhoneNumberUtil::formatInOriginalFormat #3

Open mdinler opened 2 years ago

mdinler commented 2 years ago

Result of manual intrumentation: bild

After comparing the above result with IntelliJ's built in JaCoCo, the results are accurate. One difference is that JaCoCo shows a "partial coverage" on an if-statement with an || operator.

3.5.1 Answers:

  1. My own coverage measurement tool doesn't take ternary operators or exceptions into consideration since the instrumented function contains neither one of those. I would say that it is quite accurate for the chosen function.
  2. The tool is quite limited since it can only measure one function and only the current implementation. If for example a new branch (e.g. if-statement) is added to the function, the tool will not react to that. Some manual instrumentation would be needed. A third limitation is that an else-statement has to be manually added in order to measure branch coverage for an if-statement without an else.
  3. Yes it is quite consistent with IntelliJ's built in JaCoCo except for one case where JaCoCo complains about partial coverage for an if-statement with an || operator (even if the else-statement is covered), and a "red indication" on a switch-statement even if all cases are covered.