We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1f71216 commit 57dcbfeCopy full SHA for 57dcbfe
rust-tests/cbmc-reg/NondetVectors/bytes.rs
@@ -0,0 +1,27 @@
1
+// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+// SPDX-License-Identifier: Apache-2.0 OR MIT
3
+use std::convert::TryInto;
4
+
5
+fn __nondet<T>() -> T {
6
+ unimplemented!()
7
+}
8
9
+fn main() {
10
+ let input: &[u8] = &vec![
11
+ __nondet(),
12
13
14
15
16
17
18
19
+ ];
20
+ let buffer = input.as_ref();
21
+ let bytes: [u8; 8] = buffer.try_into().unwrap();
22
+ let value = u64::from_be_bytes(bytes);
23
+ let idx: usize = __nondet();
24
+ if idx < 8 {
25
+ assert!(u64::to_be_bytes(value)[idx] == input[idx]);
26
+ }
27
0 commit comments