Sunday, 4 November 2012

What is LCSAJ Testing?

What is LCSAJ Testing?



 
 
LCSAJ stands for Linear Code Sequence And Jump) is defined as a linear sequence of executable code commencing either from the start of a program or from a point to which control flow ay jump and terminated either by a specific control flow jump or by the end of the program. It may contain predicates which must be satisfied in order to execute the linear code sequence and terminating jump.

Example

Some reformatting may be needed to allow LCSAJs to be expressed in terms of line numbers. The
basic reformatting rule is that each branch must leave from the end of a line and arrive at the start of a line.





Consider the following program which is designed to categorise positive integers into prime and nonprime, and to give factors for those which are non-prime. Note that integer division is used, so Num DIV 2 will give a value of 2 when Num = 5, for example. The code on line 5 calculates the remainder left after Factor is divided into Num. For example, if Factor is 5 and Num is 13, the expression evaluates to 3. For reasons of simplicity, the program makes no checks on the input.

 
1   READ (Num);
2      WHILE NOT End of File DO
3      Prime := TRUE;
4          FOR Factor := 2 TO Num DIV 2 DO
5             IF Num - (Num DIV Factor)*Factor = 0 THEN
6              WRITE (Factor, ` is a factor of', Num);
7              Prime := FALSE;
8              ENDIF;
9             ENDFOR;
10           IF Prime = TRUE THEN
11          WRITE (Num, ` is prime');
12        ENDIF;
13      READ (Num);
14     ENDWHILE;
15 WRITE (`End of prime number program');




www.ISEB-sofwaretesting.weebly.com

1 comment: