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 @@ -2364,34 +2364,4 @@ mod tests {
2364
2364
}
2365
2365
}
2366
2366
}
2367
-
2368
- #[ test]
2369
- fn test_zst_push ( ) {
2370
- const N : usize = 8 ;
2371
-
2372
- // Zero sized type
2373
- struct Zst ;
2374
-
2375
- // Test that for all possible sequences of push_front / push_back,
2376
- // we end up with a deque of the correct size
2377
-
2378
- for len in 0 ..N {
2379
- let mut tester = VecDeque :: with_capacity ( len) ;
2380
- assert_eq ! ( tester. len( ) , 0 ) ;
2381
- assert ! ( tester. capacity( ) >= len) ;
2382
- for case in 0 ..( 1 << len) {
2383
- assert_eq ! ( tester. len( ) , 0 ) ;
2384
- for bit in 0 ..len {
2385
- if case & ( 1 << bit) != 0 {
2386
- tester. push_front ( Zst ) ;
2387
- } else {
2388
- tester. push_back ( Zst ) ;
2389
- }
2390
- }
2391
- assert_eq ! ( tester. len( ) , len) ;
2392
- assert_eq ! ( tester. iter( ) . count( ) , len) ;
2393
- tester. clear ( ) ;
2394
- }
2395
- }
2396
- }
2397
2367
}
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