Skip to main content

test_rosso/
lib.rs

1//! # My Crate
2//!
3//! `my_crate` is a collection of utilities to make performing certain
4//! calculations more convenient.
5
6/// Adds one to the number given.
7///
8/// # Examples
9///
10/// ```
11/// let arg = 5;
12/// let answer = my_crate::add_one(arg);
13///
14/// assert_eq!(6, answer);
15/// ```
16pub fn add_one(x: i32) -> i32 {
17    x + 1
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23
24    #[test]
25    fn it_works() {
26        let result = add_one(2);
27        assert_eq!(3, result);
28    }
29}