Last active
November 26, 2024 12:39
-
-
Save masiarek/90e1d937e02e36f746cf89328f4fdd62 to your computer and use it in GitHub Desktop.
compilation fails - however, cargo test is OK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn factorial(n: u64) -> u64 { | |
if n == 0 || n == 1 { | |
1 | |
} else { | |
n * factorial(n - 1) | |
} | |
} | |
#[cfg(test)] | |
mod tests { | |
use crate::factorial; | |
#[test] | |
fn first() { | |
assert_eq!(factorial(0), 1); | |
} | |
#[test] | |
fn fifth() { | |
assert_eq!(factorial(4), 24); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment