mirror of
https://github.com/notohh/rustlings.git
synced 2024-11-22 14:02:22 -05:00
Create tests for if1.rs
This provides standardize feedback if a solution is correct. Fixes #46.
This commit is contained in:
parent
5029525594
commit
0cc668c012
1 changed files with 14 additions and 5 deletions
19
if/if1.rs
19
if/if1.rs
|
@ -1,4 +1,4 @@
|
||||||
fn bigger(a: i32, b:i32) -> i32 {
|
pub fn bigger(a: i32, b:i32) -> i32 {
|
||||||
// Complete this function to return the bigger number!
|
// Complete this function to return the bigger number!
|
||||||
// Do not use:
|
// Do not use:
|
||||||
// - return
|
// - return
|
||||||
|
@ -7,11 +7,20 @@ fn bigger(a: i32, b:i32) -> i32 {
|
||||||
// Scroll down for hints.
|
// Scroll down for hints.
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
#[cfg(test)]
|
||||||
assert_eq!(10, bigger(10, 8));
|
mod tests {
|
||||||
assert_eq!(42, bigger(32, 42));
|
use super::*;
|
||||||
}
|
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn ten_is_bigger_than_eight() {
|
||||||
|
assert_eq!(10, bigger(10, 8));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fortytwo_is_bigger_than_thirtytwo() {
|
||||||
|
assert_eq!(42, bigger(32, 42));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue