Auto merge of #836 - RalfJung:arrays, r=RalfJung
test some const-generic-using methods
This commit is contained in:
commit
3655480078
2 changed files with 18 additions and 0 deletions
|
|
@ -33,6 +33,21 @@ fn slice_index() -> u8 {
|
|||
arr[5]
|
||||
}
|
||||
|
||||
fn eq() {
|
||||
const N: usize = 16;
|
||||
type Array = [u8; N];
|
||||
let array1: Array = [0; N];
|
||||
let array2: Array = [0; N];
|
||||
let array3: Array = [1; N];
|
||||
assert_eq!(array1, array2);
|
||||
assert_ne!(array1, array3);
|
||||
}
|
||||
|
||||
fn debug() {
|
||||
let array = [0u8, 42, 13, 71];
|
||||
println!("{:?}", array);
|
||||
}
|
||||
|
||||
fn main() {
|
||||
assert_eq!(empty_array(), []);
|
||||
assert_eq!(index_unsafe(), 20);
|
||||
|
|
@ -42,4 +57,6 @@ fn main() {
|
|||
assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]);
|
||||
assert_eq!(array_repeat(), [42; 8]);
|
||||
assert_eq!(mini_array(), [42]);
|
||||
eq();
|
||||
debug();
|
||||
}
|
||||
|
|
|
|||
1
tests/run-pass/arrays.stdout
Normal file
1
tests/run-pass/arrays.stdout
Normal file
|
|
@ -0,0 +1 @@
|
|||
[0, 42, 13, 71]
|
||||
Loading…
Add table
Add a link
Reference in a new issue