Created
May 19, 2023 20:56
-
-
Save henryobiaraije/238232178920d3d4fcbb8bd721db3de4 to your computer and use it in GitHub Desktop.
Writing unit test for the Calculator struct.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Full tutorial here https://youtu.be/LJppDNH2CHI | |
#[cfg(test)] | |
mod test{ | |
use crate::Calculator; | |
#[test] | |
fn test_addition(){ | |
let mut calculator = Calculator::new(); | |
calculator.set_result(4.0); | |
calculator.add([5.0,5.0].to_vec()); | |
assert_eq!(14.0, calculator.get_result()) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment