skmgoldin / tcr

A generic token-curated registry
Apache License 2.0
279 stars 131 forks source link

Increase test coverage to at least 85% for branches and 95% for statements #51

Open akuanti opened 6 years ago

akuanti commented 6 years ago

As of f89eb89, coverage output looks like this:

--------------------|----------|----------|----------|----------|----------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------|----------|----------|----------|----------|----------------|
 contracts/         |    97.36 |    66.87 |    98.18 |    97.04 |                |
  PLCRVoting.sol    |     96.2 |    55.17 |    95.45 |    95.24 |102,103,105,370 |
  Parameterizer.sol |    98.82 |    68.18 |      100 |    98.85 |            223 |
  Registry.sol      |    97.03 |    76.56 |      100 |    96.97 |    136,137,139 |
--------------------|----------|----------|----------|----------|----------------|
All files           |    97.36 |    66.87 |    98.18 |    97.04 |                |
--------------------|----------|----------|----------|----------|----------------|

% Stmts should be at least 95% and % Branch should be at least 85%. These targets currently exclude tests for where token transfers fail. They also exclude PLCRVoting.sol, since that will be consumed from EPM in the future, and the tests really belong in the PLCRVoting repository.

Non-covered test cases to be added:

Parameterizer

proposeRarameterization

challengeReparameterization

processProposal

claimReward

resolveChallenge

Registry

apply

withdraw

exit

challenge

determineReward

akuanti commented 6 years ago
--------------------|----------|----------|----------|----------|----------------|
File                |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
--------------------|----------|----------|----------|----------|----------------|
 contracts/         |    98.87 |    77.11 |    98.18 |    98.52 |                |
  PLCRVoting.sol    |     96.2 |    55.17 |    95.45 |    95.24 |102,103,105,370 |
  Parameterizer.sol |      100 |    84.09 |      100 |      100 |                |
  Registry.sol      |      100 |    92.19 |      100 |      100 |                |
--------------------|----------|----------|----------|----------|----------------|
All files           |    98.87 |    77.11 |    98.18 |    98.52 |                |
--------------------|----------|----------|----------|----------|----------------|

We do not quite reach 85% branch coverage in Parameterizer.sol due to several calls to token.transfer(), as well as some assertions.