-
Notifications
You must be signed in to change notification settings - Fork 97
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
Complete tests for count intrinsics #883
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.
Those are nice tests. I added minor comments.
use std::intrinsics::cttz_nonzero; | ||
|
||
// Call `cttz_nonzero` with an unconstrained symbolic argument | ||
macro_rules! test_cttz_nonzero { |
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.
Why is this named nonzero?
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.
Because it is testing the cttz_nonzero
intrinsic.
@@ -0,0 +1,25 @@ | |||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | |||
// SPDX-License-Identifier: Apache-2.0 OR MIT | |||
// kani-verify-fail |
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.
Won't this test pass if just one property fail?
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.
Yes, however they are all encoded the same way so it is very likely that if one stops failing (for any reason) the rest will stop failing too.
tests/kani/Intrinsics/Count/ctlz.rs
Outdated
// exclude zero | ||
macro_rules! test_ctlz_nonzero { | ||
($ty:ty) => { | ||
let var_nonzero: $ty = 8; |
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.
Was this intended to be assigned to kani::any()
instead of 8?
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.
Yes, thanks for catching it! Fixed 😄
* Complete tests for count intrinsics * Use `kani::any()` instead of concrete value in `test_ctlz_nonzero`
* Complete tests for count intrinsics * Use `kani::any()` instead of concrete value in `test_ctlz_nonzero`
* Complete tests for count intrinsics * Use `kani::any()` instead of concrete value in `test_ctlz_nonzero`
* Complete tests for count intrinsics * Use `kani::any()` instead of concrete value in `test_ctlz_nonzero`
Description of changes:
Adds more complete tests for count intrinsics. Removes the old tests that were based on concrete values.
Resolved issues:
Resolves #26
Part of #727
Call-outs:
Testing:
How is this change tested? Existing regression + changes to tests.
Is this a refactor change? No.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.