]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-12860.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / issue-12860.rs
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
11 // pretty-expanded FIXME #23616
12
13 #![feature(collections)]
14
15 extern crate collections;
16
17 use std::collections::HashSet;
18
19 #[derive(Copy, PartialEq, Eq, Hash)]
20 struct XYZ {
21     x: int,
22     y: int,
23     z: int
24 }
25
26 fn main() {
27     let mut connected = HashSet::new();
28     let mut border = HashSet::new();
29
30     let middle = XYZ{x: 0, y: 0, z: 0};
31     border.insert(middle);
32
33     while border.len() > 0 && connected.len() < 10000 {
34         let choice = *(border.iter().next().unwrap());
35         border.remove(&choice);
36         connected.insert(choice);
37
38         let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z};
39         let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z};
40         let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z};
41         let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z};
42         let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1};
43         let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1};
44
45         if !connected.contains(&cxp) {
46             border.insert(cxp);
47         }
48         if  !connected.contains(&cxm){
49             border.insert(cxm);
50         }
51         if !connected.contains(&cyp){
52             border.insert(cyp);
53         }
54         if !connected.contains(&cym) {
55             border.insert(cym);
56         }
57         if !connected.contains(&czp){
58             border.insert(czp);
59         }
60         if !connected.contains(&czm) {
61             border.insert(czm);
62         }
63     }
64 }