initial commit
This commit is contained in:
10
exercises/02_basic_calculator/01_integers/Cargo.toml
Normal file
10
exercises/02_basic_calculator/01_integers/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "integers"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[lints.rust]
|
||||
# We silence dead code warnings for the time being in order to reduce
|
||||
# compiler noise.
|
||||
# We'll re-enable them again once we explain how visibility works in Rust.
|
||||
dead_code = "allow"
|
||||
15
exercises/02_basic_calculator/01_integers/src/lib.rs
Normal file
15
exercises/02_basic_calculator/01_integers/src/lib.rs
Normal file
@@ -0,0 +1,15 @@
|
||||
fn compute(a: u32, b: u32) -> u32 {
|
||||
// TODO: change the line below to fix the compiler error and make the tests pass.
|
||||
let multiplier: u8 = 4;
|
||||
a + b * multiplier
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::compute;
|
||||
|
||||
#[test]
|
||||
fn case() {
|
||||
assert_eq!(compute(1, 2), 9);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user