mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-02-24 05:13:29 +08:00
18 lines
245 B
Rust
Executable File
18 lines
245 B
Rust
Executable File
pub fn add_two(a: i32) -> i32 {
|
|
internal_adder(a, 2)
|
|
}
|
|
|
|
fn internal_adder(a: i32, b: i32) -> i32 {
|
|
a + b
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn internal() {
|
|
assert_eq!(4, internal_adder(2, 2));
|
|
}
|
|
}
|