Skip to content

Commit 45337c7

Browse files
committed
Add divide function
1 parent 806c98c commit 45337c7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ pub fn multiply(a: i32, b: i32) -> i32 {
33
a * b
44
}
55

6+
/// Divides two integers
7+
pub fn divide(a: i32, b: i32) -> i32 {
8+
a / b
9+
}
10+
611
#[cfg(test)]
712
mod test {
813
use super::*;
@@ -11,4 +16,9 @@ mod test {
1116
fn test() {
1217
assert_eq!(multiply(2, 2), 4);
1318
}
19+
20+
#[test]
21+
fn test2() {
22+
assert_eq!(divide(4, 2), 2);
23+
}
1424
}

0 commit comments

Comments
 (0)