Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
13 of 16 tasks
akuanti opened this issue Apr 2, 2018 · 1 comment
Open
13 of 16 tasks

Comments

@akuanti
Copy link
Collaborator

akuanti commented Apr 2, 2018

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

  • should revert if the proposal is a NOOP

challengeReparameterization

  • should revert if the proposal does not exist
  • should revert if the proposal already has a challenge against it

processProposal

  • should revert in the else case
  • (these may not be possible to test)
    • should revert if the set dispensationPct is greater than 100
    • should revert if the set pDispensationPct is greater than 100

claimReward

  • should revert if the sender has already claimed their tokens

resolveChallenge

  • cover case where the challenge failed and the processBy date has passed
    • it should not set the value, and it should transfer tokens to the proposal owner

Registry

apply

  • should revert if the deposit amount is less than the minDeposit

withdraw

  • should revert if the message sender is not the owner of the listing
  • should be able to withdraw tokens and decrease the unstaked deposit

exit

  • should revert if the listing is in the application stage

challenge

  • should revert if the application is not in the apply stage and is not on the whitelist
  • should revert if the application currently has an open challenge against it

determineReward

  • should revert if the challenge has already been resolved
  • should revert if the poll has not ended yet
@akuanti
Copy link
Collaborator Author

akuanti commented Apr 4, 2018

--------------------|----------|----------|----------|----------|----------------|
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant