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