]>
Commit | Line | Data |
---|---|---|
e9174d1e SL |
1 | // Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | // file at the top-level directory of this distribution and at | |
3 | // http://rust-lang.org/COPYRIGHT. | |
4 | // | |
5 | // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | |
6 | // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | |
7 | // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | |
8 | // option. This file may not be copied, modified, or distributed | |
9 | // except according to those terms. | |
10 | use core::array::FixedSizeArray; | |
11 | ||
12 | #[test] | |
13 | fn fixed_size_array() { | |
14 | let mut array = [0; 64]; | |
15 | let mut zero_sized = [(); 64]; | |
16 | let mut empty_array = [0; 0]; | |
17 | let mut empty_zero_sized = [(); 0]; | |
18 | ||
19 | assert_eq!(FixedSizeArray::as_slice(&array).len(), 64); | |
20 | assert_eq!(FixedSizeArray::as_slice(&zero_sized).len(), 64); | |
21 | assert_eq!(FixedSizeArray::as_slice(&empty_array).len(), 0); | |
22 | assert_eq!(FixedSizeArray::as_slice(&empty_zero_sized).len(), 0); | |
23 | ||
24 | assert_eq!(FixedSizeArray::as_mut_slice(&mut array).len(), 64); | |
25 | assert_eq!(FixedSizeArray::as_mut_slice(&mut zero_sized).len(), 64); | |
26 | assert_eq!(FixedSizeArray::as_mut_slice(&mut empty_array).len(), 0); | |
27 | assert_eq!(FixedSizeArray::as_mut_slice(&mut empty_zero_sized).len(), 0); | |
28 | } |