Rust Testing
Reproducible testing is important for reliable software development. Rust has a powerful built-in testing features, so that test can be writting under the test modules, and invoked by cargo test. For more details, see rust doc. This blogs will focus on some convenient use cases. How to Write Tests. fn plus_one(x: i32) -> i32 { x + 1 } fn main() { } #[cfg(test)] mod tests{ #[test] fn it_works() { assert_eq!(2, super::plus_one(1)); } } And fire the test with cargo test. ...