-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add an AllocatedNum addition constraint #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot! I think we can do a bit better on testing, but this is looking good.
@@ -539,6 +571,21 @@ mod test { | |||
assert!(cs.get("num") == Fr::ONE); | |||
} | |||
|
|||
#[test] | |||
fn test_num_addition() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great to see some negative testing here.
Another useful tool would be to exemplify the modular nature of the addition, e.g. by using something close to the field modulus as one of the operands.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the test.
assert!(cs.is_satisfied()); | ||
assert!(cs.get("sum num") == Fr::ZERO); | ||
assert!(c.value.unwrap() == Fr::ZERO); | ||
cs.set("sum num", Fr::ONE); | ||
assert!(!cs.is_satisfied()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@huitseeker By negative testing, do you mean to add tests such that the constraint system is not satisfied ? I am checking for this on lines 591-592.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, TYSVM!
This pull request is corresponding to issue #33 created by @huitseeker. Added AllocatedNum addition constraint and corresponding test.