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

Account convenience methods improperly check arithmetic #6

Closed
2 tasks done
jmcph4 opened this issue Apr 7, 2020 · 1 comment
Closed
2 tasks done

Account convenience methods improperly check arithmetic #6

jmcph4 opened this issue Apr 7, 2020 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@jmcph4
Copy link
Owner

jmcph4 commented Apr 7, 2020

Reproduction

let acct: Account = Account::new(1, "John Doe".to_string(), 0, HashMap::new());
let res: Result<(), AccountError> = acct.add_balance(1);
assert_eq!(res, Ok(()));

Actual Behaviour

Assert fails, as Account::add_balance returns AccountError::BalanceOutOfBounds.

Expected Behaviour

Assert succeeds, as Account::add_balance returns Ok(()).

Tasks

  • Invert conditions in bounds checks for add_balance
  • Invert conditions in bounds checks for add_holding
@jmcph4 jmcph4 added the bug Something isn't working label Apr 7, 2020
@jmcph4 jmcph4 self-assigned this Apr 7, 2020
@jmcph4
Copy link
Owner Author

jmcph4 commented Apr 8, 2020

Closed by 02afee2.

@jmcph4 jmcph4 closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant