0% found this document useful (0 votes)
47 views1 page

Exercise 1

This document discusses exercise 1 which involves creating a control flow graph and test cases for a code snippet. The code snippet declares and initializes two float variables, reads their values, conditionally increments one value, divides one by the other, and writes the values out. Test cases should be created using node coverage and edge coverage criteria to check if any faults are identified. Control flow graphs represent code as nodes for statements and edges for possible execution paths between statements.

Uploaded by

sanober shahin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views1 page

Exercise 1

This document discusses exercise 1 which involves creating a control flow graph and test cases for a code snippet. The code snippet declares and initializes two float variables, reads their values, conditionally increments one value, divides one by the other, and writes the values out. Test cases should be created using node coverage and edge coverage criteria to check if any faults are identified. Control flow graphs represent code as nodes for statements and edges for possible execution paths between statements.

Uploaded by

sanober shahin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercise 1

1. void f() {
2. float x;
3. float y;
4. x = read();
5. y = read();
6. if (x > 0)
7. x += 10;
8. y = y / x;
9. write(x);
10. write(y);
11. }

 Create the control flow graph of this program

 Write the test cases using the following coverage criteria

 Node coverage (statement coverage)

 Edge coverage (branch coverage)

 Do they identify the fault ?

Note well:

 Create one node for each atomic statement


 Compound statements must be divided into atomic statements
 Create an edge from node N1 to node N2 if during the execution the corresponding
statements can be executed one immediately after the other

You might also like