mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-04-21 12:58:08 +08:00
15 lines
200 B
Rust
15 lines
200 B
Rust
pub fn add_two(a: usize) -> usize {
|
|
a + 2
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn it_adds_two() {
|
|
let result = add_two(2);
|
|
assert_eq!(result, 4);
|
|
}
|
|
}
|