//! Testing
//! doc test allows
//! - public function
//! - displayed in rustdoc output
//! - demo expected cases and examples

fn main() {}

/// ```rust
/// use example::Direction;
/// let way_home = Direction::North;
/// ```
pub enum Direction {
    North,
    South,
    East,
    West,
}

fn is_north(dir: Direction) -> bool {
    match dir {
        Direction::North => true,
        _ => false,
    }
}

// in module unit test
#[test]
fn is_north_works() {
    assert!(is_north(Direction::North) == true);
    assert!(is_north(Direction::South) == false);
}

// submodule unit test
mod tests {
    use super::{is_north, Direction};

    #[test]
    fn is_north_works_sub() {
        assert!(is_north(Direction::North) == true);
        assert!(is_north(Direction::South) == false);
    }
}
