官术网_书友最值得收藏!

Assert yourself!

Unit testing provides the developer with a number of methods called assertion methods:

#[test] 
fn multiply() 
{ 
   assert_eq!(5, 2 * 3); 
} 

In the preceding code snippet, we use the assert_eq! (assert equal) macro. The first argument is the answer expected, and the second argument is what is being tested. If 2 * 3 = 5, then the assertion is true and passes the unit test.

主站蜘蛛池模板: 安西县| 南康市| 武汉市| 青浦区| 寿光市| 临颍县| 龙井市| 永康市| 阜城县| 蓝田县| 合水县| 清远市| 靖江市| 碌曲县| 济源市| 宁波市| 神木县| 绩溪县| 峨山| 龙山县| 红桥区| 阜平县| 元谋县| 德清县| 广饶县| 大姚县| 南溪县| 盐池县| 常山县| 南汇区| 密山市| 繁昌县| 东明县| 万载县| 临邑县| 台州市| 咸丰县| 铜梁县| 息烽县| 宁城县| 依兰县|