-
Notifications
You must be signed in to change notification settings - Fork 490
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 remaining assert_xx!
comparison test macros
#4936
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.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
a discussion (no related file):
do you know why these don't exist in rust - and why is our situation different?
TBH initially I didn't check if and why Rust didn't support all of them, but I did now. As they found out, these asserts are not used frequently. I don't have any data to prove if Cairo ones would or wouldn't be used more, but based on my experience of writing Cairo tests daily, they can be useful, especially since generic In an ideal world, this could be a standalone helper library like The biggest reason why Cairo situation is different is the debugging experience. In Rust, I don't need these asserts as I can just put a breakpoint in an IDE and check the values, but Cario debugging still relies on printing or going low level. I don't want to go into too much details, but IMO this can sometimes make life easier. :) |
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
a discussion (no related file):
@gilbens-starkware for 2nd eye.
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.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
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.
Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
corelib/src/test/testing_test.cairo
line 84 at r2 (raw file):
assert_ge!(2, 1); assert_ge!(2, 2); }
add types - as felt252s aren't ordered.
Code quote:
#[test]
fn test_assert_lt_with_description() {
assert_lt!(1, 2, "Description");
}
#[test]
fn test_assert_lt_no_description() {
assert_lt!(1, 2);
}
#[test]
fn test_assert_le_with_description() {
assert_le!(1, 2, "Description");
assert_le!(1, 1, "Description");
}
#[test]
fn test_assert_le_no_description() {
assert_le!(1, 2);
assert_le!(1, 1);
}
#[test]
fn test_assert_gt_with_description() {
assert_gt!(2, 1, "Description");
}
#[test]
fn test_assert_gt_no_description() {
assert_gt!(2, 1);
}
#[test]
fn test_assert_ge_with_description() {
assert_ge!(2, 1, "Description");
assert_ge!(2, 2, "Description");
}
#[test]
fn test_assert_ge_no_description() {
assert_ge!(2, 1);
assert_ge!(2, 2);
}
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.
Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @iamvukasin)
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.
Reviewed all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @iamvukasin)
a discussion (no related file):
Please rebase and make sure tests pass, these didn't pass since we approved.
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.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @iamvukasin)
corelib/src/test/testing_test.cairo
line 43 at r6 (raw file):
#[test] fn test_assert_lt_with_description() {
It is possibly due to the test being u256, just change to u8 and check the tests are fine.
Head branch was pushed to by a user without write access
Done. Had to decrease |
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.
Reviewed 2 of 2 files at r7, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @iamvukasin)
This change is