File tree 2 files changed +41
-30
lines changed
2 files changed +41
-30
lines changed Original file line number Diff line number Diff line change @@ -2362,34 +2362,4 @@ mod tests {
2362
2362
}
2363
2363
}
2364
2364
}
2365
-
2366
- #[ test]
2367
- fn test_zst_push ( ) {
2368
- const N : usize = 8 ;
2369
-
2370
- // Zero sized type
2371
- struct Zst ;
2372
-
2373
- // Test that for all possible sequences of push_front / push_back,
2374
- // we end up with a deque of the correct size
2375
-
2376
- for len in 0 ..N {
2377
- let mut tester = VecDeque :: with_capacity ( len) ;
2378
- assert_eq ! ( tester. len( ) , 0 ) ;
2379
- assert ! ( tester. capacity( ) >= len) ;
2380
- for case in 0 ..( 1 << len) {
2381
- assert_eq ! ( tester. len( ) , 0 ) ;
2382
- for bit in 0 ..len {
2383
- if case & ( 1 << bit) != 0 {
2384
- tester. push_front ( Zst ) ;
2385
- } else {
2386
- tester. push_back ( Zst ) ;
2387
- }
2388
- }
2389
- assert_eq ! ( tester. len( ) , len) ;
2390
- assert_eq ! ( tester. iter( ) . count( ) , len) ;
2391
- tester. clear ( ) ;
2392
- }
2393
- }
2394
- }
2395
2365
}
Original file line number Diff line number Diff line change
1
+ // Copyright 2013 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
+
11
+ use std:: collections:: VecDeque ;
12
+ use std:: iter:: Iterator ;
13
+
14
+ fn main ( ) {
15
+ const N : usize = 8 ;
16
+
17
+ // Zero sized type
18
+ struct Zst ;
19
+
20
+ // Test that for all possible sequences of push_front / push_back,
21
+ // we end up with a deque of the correct size
22
+
23
+ for len in 0 ..N {
24
+ let mut tester = VecDeque :: with_capacity ( len) ;
25
+ assert_eq ! ( tester. len( ) , 0 ) ;
26
+ assert ! ( tester. capacity( ) >= len) ;
27
+ for case in 0 ..( 1 << len) {
28
+ assert_eq ! ( tester. len( ) , 0 ) ;
29
+ for bit in 0 ..len {
30
+ if case & ( 1 << bit) != 0 {
31
+ tester. push_front ( Zst ) ;
32
+ } else {
33
+ tester. push_back ( Zst ) ;
34
+ }
35
+ }
36
+ assert_eq ! ( tester. len( ) , len) ;
37
+ assert_eq ! ( tester. iter( ) . count( ) , len) ;
38
+ tester. clear ( ) ;
39
+ }
40
+ }
41
+ }
You can’t perform that action at this time.
0 commit comments