Skip to content

Commit f1b623c

Browse files
committed
test some const-generic-using methods
1 parent b5ddc94 commit f1b623c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

tests/run-pass/arrays.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ fn slice_index() -> u8 {
3333
arr[5]
3434
}
3535

36+
fn eq() {
37+
const N: usize = 16;
38+
type Array = [u8; N];
39+
let array1: Array = [0; N];
40+
let array2: Array = [0; N];
41+
let array3: Array = [1; N];
42+
assert_eq!(array1, array2);
43+
assert_ne!(array1, array3);
44+
}
45+
46+
fn debug() {
47+
let array = [0u8, 42, 13, 71];
48+
println!("{:?}", array);
49+
}
50+
3651
fn main() {
3752
assert_eq!(empty_array(), []);
3853
assert_eq!(index_unsafe(), 20);
@@ -42,4 +57,6 @@ fn main() {
4257
assert_eq!(array_array(), [[5, 4], [3, 2], [1, 0]]);
4358
assert_eq!(array_repeat(), [42; 8]);
4459
assert_eq!(mini_array(), [42]);
60+
eq();
61+
debug();
4562
}

tests/run-pass/arrays.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[0, 42, 13, 71]

0 commit comments

Comments
 (0)