Add tests for constant-evaluated intrinsics#1042
Merged
adpaco-aws merged 10 commits intomodel-checking:mainfrom Apr 14, 2022
Merged
Add tests for constant-evaluated intrinsics#1042adpaco-aws merged 10 commits intomodel-checking:mainfrom
adpaco-aws merged 10 commits intomodel-checking:mainfrom
Conversation
zhassan-aws
reviewed
Apr 14, 2022
| fn main() { | ||
| // Scalar types | ||
| let _ = type_id::<i8>(); | ||
| let _ = type_id::<i16>(); |
Contributor
There was a problem hiding this comment.
Would adding some asserts make sense, e.g.
let i8_tid = type_id::<i8>();
let i16_tid = type_id::<i16>();
assert_ne!(i8_tid, i16_tid)?
If so, perhaps add one assert for every two consecutive types (one for (i8, i16), one for (i16, i32), etc.).
zhassan-aws
approved these changes
Apr 14, 2022
| kani::assume(i < type_ids.len()); | ||
| kani::assume(j < type_ids.len()); | ||
| if i != j { | ||
| assert_ne!(type_ids[i], type_ids[j]); |
Closed
tedinski
pushed a commit
to tedinski/rmc
that referenced
this pull request
Apr 26, 2022
* Move test for `needs_drop` * Minor change to description in `needs_drop` test * Add test for `type_name` * Add test for `type_id` * Add test for `size_of` * Add test for `pref_align_of` * Add test for `min_align_of` * Include a comment for `codegen_intrinsic_const` * In `type_id` test, assert no duplicates
tedinski
pushed a commit
that referenced
this pull request
Apr 27, 2022
* Move test for `needs_drop` * Minor change to description in `needs_drop` test * Add test for `type_name` * Add test for `type_id` * Add test for `size_of` * Add test for `pref_align_of` * Add test for `min_align_of` * Include a comment for `codegen_intrinsic_const` * In `type_id` test, assert no duplicates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of changes:
Adds 6 tests (5 added, 1 moved) to the
ConstEvalfolder for constant-evaluated intrinsics, which are the following:size_oftype_idtype_namemin_align_ofneeds_droppref_align_ofThe tests cover common data types. A comment for the macro that produces these values is also included.
Resolved issues:
Part of #727
Call-outs:
The test for
type_idis not very strong. This is because the result is au64value that comes from the typing context.Testing:
How is this change tested? Adds 5 new 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.