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

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.

主站蜘蛛池模板: 甘洛县| 绵竹市| 塔河县| 金坛市| 巩义市| 墨竹工卡县| 嵊州市| 陇西县| 虹口区| 东乡族自治县| 武夷山市| 三都| 韶关市| 开封县| 宕昌县| 潮州市| 元朗区| 通辽市| 新竹市| 石林| 禄劝| 云霄县| 禹城市| 阜宁县| 白河县| 浠水县| 江安县| 左云县| 莱芜市| 从江县| 雷山县| 老河口市| 麻栗坡县| 五大连池市| 全椒县| 景宁| 乐亭县| 福安市| 恩施市| 乐业县| 新干县|