You are on page 1of 1

A short note to software QA

The Hungarian origin of this note was published in Új Alaplap (HU ISSN 0865-0187) in ~1992.

The programmers must both verify and validate their new programs. These are different
tasks.

Let us assume that the new program solves the equation

ax2+bx+c=0

−b± √ b −4ac
2
x 1,2=
2a

The Fortran program may be the next one.

PROGRAM note_to_SWQA
! coefficients a, b, and c are read from the console
! the solution x1 and x2 are sent to the console
IMPLICIT NONE
REAL :: a,b,c,x1,x2
READ (*,*) a,b,c
x1=(-b+SQRT(b**2-4*a*c))/(2*a)
x2=(-b-SQRT(b**2-4*a*c))/(2*a)
WRITE (*,*) x1,x2
STOP
END PROGRAM note_to_SWQA

The verification is O.K. The coding of the program refers to the well-known solving formula.

Nevertheless, the validation aborts. If the input a equals zero, the program stops due to
the error “division by zero”. If b2<4ac, the solution will be COMPLEX, but no COMPLEX
variable is declared. As the consequence, the program stops due to the error “SQRT
with negative argument”. These possible errors shall be treated by the programmer.

The not experienced programmers often omit the validation during the QA procedure.

Egon J. Szondi
July 20, 2018.

You might also like