全数检查(Exhaustive Test),是指对送交检验的全部产品根据质量标准逐件进行试验测定,以判断每一件产品是否合格,并挑出不合格产品的一种检验方法。
这段代码正确地报告了完全数,但是由于反向测试的原因,代码运行得非常慢,因为我需要检查大量数字。
This code correctly reports perfect Numbers, but it runs very slowly for the negative test because I'm checking so many Numbers.
在Wikipedia上查找到前几个完全数之后,我可以编写一个测试,它检查实际上是否可以找到完全数。
After checking with Wikipedia to find the first few perfect Numbers, I can write a test that verifies that I can in fact find perfect Numbers.
我至少需要两个测试:一个测试用于查看是否正确报告了完全数,另一个测试用于检查我没有得到误判断(false positives)。
I need at least two tests: one to see if the perfect Numbers report correctly and another to check that I don't get false positives. The unit tests are in Listing 2.
应用推荐