extern crate web_wars_engine; use std::collections::HashMap; use web_wars_engine::fixtures; #[test] pub fn tiles_all_have_unique_ids() { let mut ids = vec![]; for tile in fixtures::tiles::tiles() { ids.push(tile.id as i32); ids.extend(tile.variants); } let mut hash = HashMap::new(); for id in ids { if hash.contains_key(&id) { hash.insert(id, *hash.get(&id).unwrap() + 1); } else { hash.insert(id, 1); } } for id in hash.keys() { if *hash.get(id).unwrap() > 1 { assert_eq!(*id, -1); } } }