MCPcopy Index your code
hub / github.com/battlecode/battlecode-2018 / parse_bananas

Function parse_bananas

battlecode-engine/src/map/mapparser.rs:394–424  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

392 use super::*;
393 #[test]
394 fn parse_bananas() {
395 let bananas = include_str!("bananas.bc18t");
396 let map = parse_text_map(bananas).unwrap();
397
398 assert_eq!(map.orbit.amplitude, 50);
399 assert_eq!(map.orbit.period, 40);
400 assert_eq!(map.orbit.center, 100);
401
402 assert_eq!(map.asteroids.pattern[&200].karbonite, 150);
403 assert_eq!(map.mars_map.initial_karbonite[29][29], 1000);
404
405 let mut founda = false;
406 let mut foundb = false;
407 for unit in &map.earth_map.initial_units {
408 if unit.location().map_location().unwrap().x == 2
409 && unit.location().map_location().unwrap().y == 18
410 && unit.team() == Team::Red
411 && unit.unit_type() == UnitType::Worker {
412 founda = true;
413 }
414 if unit.location().map_location().unwrap().x == 2
415 && unit.location().map_location().unwrap().y == 1
416 && unit.team() == Team::Blue
417 && unit.unit_type() == UnitType::Worker {
418 foundb = true;
419 }
420
421 }
422 assert!(founda);
423 assert!(foundb);
424 }
425 #[test]
426 fn parse_fat() {
427 let fat = include_str!("fat.bc18t");

Callers

nothing calls this directly

Calls 5

parse_text_mapFunction · 0.85
map_locationMethod · 0.80
locationMethod · 0.80
unit_typeMethod · 0.80
teamMethod · 0.45

Tested by

no test coverage detected