100 exercises to learn Rust
This commit is contained in:
14
exercises/02_basic_calculator/01_integers/src/lib.rs
Normal file
14
exercises/02_basic_calculator/01_integers/src/lib.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
fn compute(a: u32, b: u32) -> u32 {
|
||||
// TODO: change the line below to fix the compiler error and make the tests pass.
|
||||
a + b * 4u8
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::compute;
|
||||
|
||||
#[test]
|
||||
fn case() {
|
||||
assert_eq!(compute(1, 2), 9);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user