Skip to content

Commit

Permalink
(feat) added test/example and exports
Browse files Browse the repository at this point in the history
  • Loading branch information
sunng87 committed Jan 28, 2015
1 parent 6bcd866 commit e8d8fce
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
16 changes: 16 additions & 0 deletions examples/types.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
extern crate geo;

use geo::*;

fn main() {
let c = Coordinate {
x: 40.02f64,
y: 116.34
};

let p = Point {
coordinate: c
};

println!("Point at ({}, {})", p.coordinate.x, p.coordinate.y);
}
6 changes: 1 addition & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
pub use types::*;

mod point;
mod types;

#[test]
fn it_works() {
}
19 changes: 19 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,22 @@ pub enum Geometry {
MultiPolygon(MultiPolygon),
GeometryCollection(GeometryCollection)
}

#[cfg(test)]
mod test {
use ::types::*;

#[test]
fn type_test() {
let c = Coordinate {
x: 40.02f64,
y: 116.34
};

let p = Point {
coordinate: c
};
assert_eq!(c.x, p.coordinate.x);
assert_eq!(c.y, p.coordinate.y);
}
}

0 comments on commit e8d8fce

Please sign in to comment.