Skip to main content

telar_geometry_core/
point.rs

1#[derive(Debug, Clone, Copy, PartialEq)]
2pub struct Point {
3    pub x: f32,
4    pub y: f32,
5}
6
7impl Point {
8    pub fn new(x: f32, y: f32) -> Self {
9        Self { x, y }
10    }
11}
12
13#[cfg(test)]
14mod tests {
15    use super::*;
16
17    #[test]
18    fn point_new_stores_coordinates() {
19        let p = Point::new(3.0, 4.0);
20        assert_eq!(p.x, 3.0);
21        assert_eq!(p.y, 4.0);
22    }
23}