rustlings

solving rustlings ft. dracuxan
git clone [email protected]:dracuxan/rustlings.git
Log | Files | Refs

if1.rs (483B)


      1 fn bigger(a: i32, b: i32) -> i32 {
      2     if a > b { a } else { b }
      3 }
      4 
      5 fn main() {
      6     // You can optionally experiment here.
      7 }
      8 
      9 // Don't mind this for now :)
     10 #[cfg(test)]
     11 mod tests {
     12     use super::*;
     13 
     14     #[test]
     15     fn ten_is_bigger_than_eight() {
     16         assert_eq!(10, bigger(10, 8));
     17     }
     18 
     19     #[test]
     20     fn fortytwo_is_bigger_than_thirtytwo() {
     21         assert_eq!(42, bigger(32, 42));
     22     }
     23 
     24     #[test]
     25     fn equal_numbers() {
     26         assert_eq!(42, bigger(42, 42));
     27     }
     28 }