fn check_primitive_block_content(block: &PrimitiveBlock) {
    let nodes: Vec<_> = block.groups().flat_map(|g| g.nodes()).collect();
    if !nodes.is_empty() {
        assert_eq!(nodes.len(), 3);

        assert!(approx_eq(nodes[1].lat(), 52.11992359584));
        assert!(approx_eq(nodes[1].lon(), 11.62564468943));

        assert!(approx_eq(nodes[2].lat(), 52.11989910567));
        assert!(approx_eq(nodes[2].lon(), 11.63101926915));

        assert_eq!(nodes[0].id(), 105);
        assert_eq!(nodes[1].id(), 106);
        assert_eq!(nodes[2].id(), 108);

        assert_eq!(nodes[0].info().uid(), Some(17));
        assert_eq!(nodes[1].info().uid(), Some(17));
        assert_eq!(nodes[2].info().uid(), Some(17));
    }

    let dense_nodes: Vec<_> = block.groups().flat_map(|g| g.dense_nodes()).collect();
    if !dense_nodes.is_empty() {
        assert_eq!(dense_nodes.len(), 3);

        assert!(approx_eq(dense_nodes[1].lat(), 52.11992359584));
        assert!(approx_eq(dense_nodes[1].lon(), 11.62564468943));

        assert!(approx_eq(dense_nodes[2].lat(), 52.11989910567));
        assert!(approx_eq(dense_nodes[2].lon(), 11.63101926915));

        assert_eq!(dense_nodes[0].id, 105);
        assert_eq!(dense_nodes[1].id, 106);
        assert_eq!(dense_nodes[2].id, 108);

        assert_eq!(dense_nodes[0].uid, 17);
        assert_eq!(dense_nodes[1].uid, 17);
        assert_eq!(dense_nodes[2].uid, 17);
    }

    {
        let ways: Vec<_> = block.groups().flat_map(|g| g.ways()).collect();
        assert_eq!(ways.len(), 1);

        let way_tags = ways[0].tags().collect::<Vec<_>>();
        assert_eq!(way_tags.len(), 2);

        assert!(way_tags.contains(&("building", "yes")));
        assert!(way_tags.contains(&("name", "triangle")));
    }

    {
        let relations: Vec<_> = block.groups().flat_map(|g| g.relations()).collect();
        assert_eq!(relations.len(), 1);

        let tags = relations[0].tags().collect::<Vec<_>>();
        assert_eq!(tags.len(), 1);
        assert!(tags.contains(&("rel_key", "rel_value")));

        let members = relations[0].members().collect::<Vec<_>>();
        assert_eq!(members.len(), 1);
        assert_eq!(members[0].role().unwrap(), "test_role");
    }
}
// Compare the content of a PrimitiveBlock with known values from the test file.
Compare the content of a PrimitiveBlock with known values from the test file.
Compare the content of a PrimitiveBlock with known values from the test file .
fn check_primitive_block_content(block: &PrimitiveBlock) {
    let nodes: Vec<_> = block.groups().flat_map(|g| g.nodes()).collect();
    if !nodes.is_empty() {
        assert_eq!(nodes.len(), 3);
        assert!(approx_eq(nodes[1].lat(), 52.11992359584));
        assert!(approx_eq(nodes[1].lon(), 11.62564468943));
        assert!(approx_eq(nodes[2].lat(), 52.11989910567));
        assert!(approx_eq(nodes[2].lon(), 11.63101926915));
        assert_eq!(nodes[0].id(), 105);
        assert_eq!(nodes[1].id(), 106);
        assert_eq!(nodes[2].id(), 108);
        assert_eq!(nodes[0].info().uid(), Some(17));
        assert_eq!(nodes[1].info().uid(), Some(17));
        assert_eq!(nodes[2].info().uid(), Some(17));
    }
    let dense_nodes: Vec<_> = block.groups().flat_map(|g| g.dense_nodes()).collect();
    if !dense_nodes.is_empty() {
        assert_eq!(dense_nodes.len(), 3);
        assert!(approx_eq(dense_nodes[1].lat(), 52.11992359584));
        assert!(approx_eq(dense_nodes[1].lon(), 11.62564468943));
        assert!(approx_eq(dense_nodes[2].lat(), 52.11989910567));
        assert!(approx_eq(dense_nodes[2].lon(), 11.63101926915));
        assert_eq!(dense_nodes[0].id, 105);
        assert_eq!(dense_nodes[1].id, 106);
        assert_eq!(dense_nodes[2].id, 108);
        assert_eq!(dense_nodes[0].uid, 17);
        assert_eq!(dense_nodes[1].uid, 17);
        assert_eq!(dense_nodes[2].uid, 17);
    }
    {
        let ways: Vec<_> = block.groups().flat_map(|g| g.ways()).collect();
        assert_eq!(ways.len(), 1);
        let way_tags = ways[0].tags().collect::<Vec<_>>();
        assert_eq!(way_tags.len(), 2);
        assert!(way_tags.contains(&("building", "yes")));
        assert!(way_tags.contains(&("name", "triangle")));
    }
    {
        let relations: Vec<_> = block.groups().flat_map(|g| g.relations()).collect();
        assert_eq!(relations.len(), 1);
        let tags = relations[0].tags().collect::<Vec<_>>();
        assert_eq!(tags.len(), 1);
        assert!(tags.contains(&("rel_key", "rel_value")));
        let members = relations[0].members().collect::<Vec<_>>();
        assert_eq!(members.len(), 1);
        assert_eq!(members[0].role().unwrap(), "test_role");
    }
}
fn check_primitive_block_content ( block : & PrimitiveBlock ) { let nodes : Vec < _ > = block . groups ( ) . flat_map ( | g | g . nodes ( ) ) . collect ( ) ; if ! nodes . is_empty ( ) { assert_eq ! ( nodes len ( ) 3 ) ; assert ! ( approx_eq ( nodes [ 1 ] lat ( ) 52.11992359584 ) ) ; assert ! ( approx_eq ( nodes [ 1 ] lon ( ) 11.62564468943 ) ) ; assert ! ( approx_eq ( nodes [ 2 ] lat ( ) 52.11989910567 ) ) ; assert ! ( approx_eq ( nodes [ 2 ] lon ( ) 11.63101926915 ) ) ; assert_eq ! ( nodes [ 0 ] id ( ) 105 ) ; assert_eq ! ( nodes [ 1 ] id ( ) 106 ) ; assert_eq ! ( nodes [ 2 ] id ( ) 108 ) ; assert_eq ! ( nodes [ 0 ] info ( ) uid ( ) Some ( 17 ) ) ; assert_eq ! ( nodes [ 1 ] info ( ) uid ( ) Some ( 17 ) ) ; assert_eq ! ( nodes [ 2 ] info ( ) uid ( ) Some ( 17 ) ) ; } let dense_nodes : Vec < _ > = block . groups ( ) . flat_map ( | g | g . dense_nodes ( ) ) . collect ( ) ; if ! dense_nodes . is_empty ( ) { assert_eq ! ( dense_nodes len ( ) 3 ) ; assert ! ( approx_eq ( dense_nodes [ 1 ] lat ( ) 52.11992359584 ) ) ; assert ! ( approx_eq ( dense_nodes [ 1 ] lon ( ) 11.62564468943 ) ) ; assert ! ( approx_eq ( dense_nodes [ 2 ] lat ( ) 52.11989910567 ) ) ; assert ! ( approx_eq ( dense_nodes [ 2 ] lon ( ) 11.63101926915 ) ) ; assert_eq ! ( dense_nodes [ 0 ] id 105 ) ; assert_eq ! ( dense_nodes [ 1 ] id 106 ) ; assert_eq ! ( dense_nodes [ 2 ] id 108 ) ; assert_eq ! ( dense_nodes [ 0 ] uid 17 ) ; assert_eq ! ( dense_nodes [ 1 ] uid 17 ) ; assert_eq ! ( dense_nodes [ 2 ] uid 17 ) ; } { let ways : Vec < _ > = block . groups ( ) . flat_map ( | g | g . ways ( ) ) . collect ( ) ; assert_eq ! ( ways len ( ) 1 ) ; let way_tags = ways [ 0 ] . tags ( ) . collect :: < Vec < _ > > ( ) ; assert_eq ! ( way_tags len ( ) 2 ) ; assert ! ( way_tags contains ( ( " " " " ) ) ) ; assert ! ( way_tags contains ( ( " " " " ) ) ) ; } { let relations : Vec < _ > = block . groups ( ) . flat_map ( | g | g . relations ( ) ) . collect ( ) ; assert_eq ! ( relations len ( ) 1 ) ; let tags = relations [ 0 ] . tags ( ) . collect :: < Vec < _ > > ( ) ; assert_eq ! ( tags len ( ) 1 ) ; assert ! ( tags contains ( ( " " " " ) ) ) ; let members = relations [ 0 ] . members ( ) . collect :: < Vec < _ > > ( ) ; assert_eq ! ( members len ( ) 1 ) ; assert_eq ! ( members [ 0 ] role ( ) unwrap ( ) " " ) ; } }
Compare the content of a PrimitiveBlock with known values from the test file.
Compare the content of a PrimitiveBlock with known values from the test file .
block
&PrimitiveBlock
block
&PrimitiveBlock