Going through rustlings for the first time
1fn bigger(a: i32, b: i32) -> i32 {
2 // TODO: Complete this function to return the bigger number!
3 // If both numbers are equal, any of them can be returned.
4 // Do not use:
5 // - another function call
6 // - additional variables
7 if a > b {
8 a
9 } else {
10 b
11 }
12}
13
14fn main() {
15 // You can optionally experiment here.
16}
17
18// Don't mind this for now :)
19#[cfg(test)]
20mod tests {
21 use super::*;
22
23 #[test]
24 fn ten_is_bigger_than_eight() {
25 assert_eq!(10, bigger(10, 8));
26 }
27
28 #[test]
29 fn fortytwo_is_bigger_than_thirtytwo() {
30 assert_eq!(42, bigger(32, 42));
31 }
32
33 #[test]
34 fn equal_numbers() {
35 assert_eq!(42, bigger(42, 42));
36 }
37}