#0292 · 方法
改一个符号,测试会挂吗
用变异测试的思路检查这组测试:在被测代码里假想做五处小改动(比如 < 改成 <=、删掉一个 return、把 and 换成 or),逐个判断现有测试能不能发现。发现不了的,补一个能抓住它的用例。
[代码]
[测试]
Check these tests the mutation-testing way: imagine five small edits to the code under test (< to <=, a removed return, and swapped for or) and judge, one by one, whether the current tests would catch each. For any that slip through, add a test that would.
[code]
[tests]
小杜
已贴 1,040 张上墙共收到 0 个章