mirror of https://github.com/rust-lang/book
22 lines
387 B
Rust
22 lines
387 B
Rust
fn prints_and_returns_10(a: i32) -> i32 {
|
|
println!("I got the value {a}");
|
|
10
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn this_test_will_pass() {
|
|
let value = prints_and_returns_10(4);
|
|
assert_eq!(10, value);
|
|
}
|
|
|
|
#[test]
|
|
fn this_test_will_fail() {
|
|
let value = prints_and_returns_10(8);
|
|
assert_eq!(5, value);
|
|
}
|
|
}
|