Rust programming video tutorial corresponding explanation content – Test

Time:2021-10-20

Video address

Headline address:https://www.ixigua.com/i676544267458235648…
Station B address:https://www.bilibili.com/video/av78062009?…
Netease cloud classroom address:https://study.163.com/course/introduction….

Explanation content

1. Write test

#[cfg(test)]
mod tests {
    #[test]
    fn it_works() {
        assert_eq!(2 + 2, 4);
    }
}

2. Run test

cargo test

3. Using the assert macro

std::assert!
std::assert_eq!
std::assert_ne!

This work adoptsCC agreement, reprint must indicate the author and the link to this article

Linghu rushed