Testing in Rust (#[test], cargo test)
Në shqip: Testet në Rust
ShpjegimiSQ
Testet në Rust shkruhen në të njëjtin skedar me kodin, me #[test] dhe makrot assert! dhe assert_eq!. cargo test i ekzekuton të gjitha — përfshirë shembujt në dokumentacion.
EnglishEN
Rust tests live in the same file as the code, with #[test] and the assert! and assert_eq! macros. cargo test runs them all — including examples in the documentation.
Si ta mendosh
Si fleta e korrigjimit e ngjitur te vetë detyra.
Lexoje në anglisht
Like the marking sheet stapled to the homework itself.
Shembull kodirust
#[test]
fn mbledh_punon() {
assert_eq!(mblidh(2, 3), 5);
}