软件测试(一)

I have met various problems when I am coding. There are several reasons as below.

  • Logical Mess

When I was dealing with ACM contest problems, this kind of fault always comes because the problems always require edge cases. Meanwhile, the logic of the problems are considerable complex.

  • Wrong Types of Variable

This kind of mistake will takes place when using strong typing language such as C, C++. When implement type casting or calculation which need high precision, improper selection of type will cause errors. Once I need to calculate the eigenvectors which are theoretically orthogonal, output showed -0.000000. It was correct when the number is regarded as 0. However, the result indicated that they are not orthogonal. In the end, it was proved that if it shows -0.000000, it is a number slightly less than 0 but no way to be able to replace 0.

As for weak typing languages such as Javascript and Matlab, though it can automatically decide which type to use, it still cause problems. It is hard for us to confirm which type they are using now. For example, once I used d3, a library of Javascript, to complete an alignment, I failed to sort an array because the functions thought I was sorting an string array so that 9 is larger than 10. Another example is that once Matlab chose a number to be uint8, the number will never be larger than 128 any more.

  • Choose wrong function or class

There are thousands of classes for Java. Some of them are quite similar to each other except some little differences like return type.

  • Environment

Some libraries are not compatible between versions, while some program will have different results when run on different hardware platforms. A project run well on me computer crashed when I transplant it to my teammates’s computer.

posted @ 2017-02-22 17:14  Ph0en1x  阅读(116)  评论(0编辑  收藏  举报