SWE 637 Homework 6
Fall 2006
Logic Coverage: Due 10/31, beginning of class


My job as an engineer is not to invent new mathematics, but to find new ways to use old mathematics.
- Dave Parnas

Answer the following questions. Bring hardcopies of your answers to class, hand written or printouts. All homeworks are due before class on the due date. Please remember that the GMU Honor Code is in effect: You may discuss the assignment with each other, the professor, or the GTA, but each homework should be done individually.

  1. Logic Coverage. (20 pts)
    Use the following program fragment to answer the questions below:
       if ((a && b) || (a && c)
          f();
       
    It yields the predicate:
             p = (a ∧ b) ∨ (a ∧ c)
    1. Identify the clauses in this predicate.
    2. Write the complete truth table for all clauses. Label your rows starting from 1, where row number 1 is all TRUE and the last row is all FALSE. (Hint: It may look like there are 24 = 16 rows, but in fact there are fewer).
    3. Cross out any rows in your table that are infeasible because of the repeated occurrence of a.
    4. Compute and simplify pa, pb, and pc.
    5. Identify all pairs of rows from your table that satisfy CACC for each variable.

Consider the following alternate program fragment:

   if (a)
   {
      if (b)
         f();
      else if (c)
         f();
   }
   
  1. Is this program fragment functionally equivalent to the first?
  2. List the truth assignments that will satisfy edge coverage on the second program fragment. If it does not matter whether one of the values is true or false in a test, use '*' for "don't care".
  3. Which of your CACC tests for the first predicate satisfy edge coverage on the second program fragment?
  4. Which, if any, of your CACC tests for the first predicate do not satisfy edge coverage on the second program fragment?