tailieunhanh - The art of software testing second edition p3
Do đó, không thử nghiệm một chương trình để cho thấy rằng nó hoạt động, thay vào đó, bạn nên bắt đầu với giả định rằng chương trình có lỗi (một giả định hợp lệ cho chương trình hầu như bất kỳ) và sau đó kiểm tra các chương trình để tìm thấy nhiều lỗi càng tốt . | 32 The Art of Software Testing expression 2 i 10 is incorrect instead it should be 2 i i 10 . If you want to determine whether i is greater than x or y i x y is incorrect instead it should be i x i y . If you want to compare three numbers for equality if a b c does something quite different. If you want to test the mathematical relation x y z the correct expression is x y y z . 6. Are there any comparisons between fractional or floatingpoint numbers that are represented in base-2 by the underlying machine This is an occasional source of errors because of truncation and base-2 approximations of base-10 numbers. 7. For expressions containing more than one Boolean operator are the assumptions about the order of evaluation and the precedence of operators correct That is if you see an expression such as if a 2 b 2 c 3 is it well understood whether the and or the or is performed first 8. Does the way in which the compiler evaluates Boolean expressions affect the program For instance the statement if x 0 x y z may be acceptable for compilers that end the test as soon as one side of an and is false but may cause a division-by-zero error with other compilers. Control-Flow Errors 1. If the program contains a multiway branch such as a computed GO TO can the index variable ever exceed the number of branch possibilities For example in the statement GO TO 200 300 400 i will i always have the value of 1 2 or 3 2. Will every loop eventually terminate Devise an informal proof or argument showing that each loop will terminate. Program Inspections Walkthroughs and Reviews 33 3. Will the program module or subroutine eventually terminate 4. Is it possible that because of the conditions upon entry a loop will never execute If so does this represent an oversight For instance if you had the following loops headed by the following statements for i x i z i . 1 while NOTFOUND . 1 what happens if NOTFOUND is initially false or if x is greater than z 5. For a loop controlled by both iteration
đang nạp các trang xem trước