homework7 - fragments given on pages 336-337, textbook. a....

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
CprE 488 Embedded Systems Design Homework 7, Fall 2006 Name: Brad Smith Lab Section: Tuesday 6-9 1. [15] Q5-4. Draw the CDFG for the following code fragments. b. if (y == 2) { r = a + b; s = c – d;} else { r = a – c;}
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
e. for (i = 0; i < N; i ++) { if (a[i] == 0) x[i] = 5; else x[i] = a[i]*b[i] }
Background image of page 2
2. [10] Q5-17. Explain why the person generating clear-box program tests should not be the person who wrote the code being tested. It would be important that it's not done by those that wrote the code because they know what types of paths are supposed to be taken and would assume things in their code. Much like proofreading a document that you've written, you tend to fill in the blanks that others would not be able to. This makes sure that the tester comes into the code fresh, figures out exactly what it is doing, and able to test it more thoroughly. 3. [15] Q5-18. Find the cyclomatic complexity of the CDFG for each of the code
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fragments given on pages 336-337, textbook. a. 4 (3 ifs +1) b. 5 (1 switch + 3 ifs) c. 3 (2 for loops) 3. [20] Q5-19. Use the branch condition testing strategy to generate a set of tests for each of the following statements. For the following code, a test is the values of a and b. Cover the possible errors given in slides 16&amp;17 in lecture 16. You dont have to do the domain testing. a. if (a &lt; b || prt1 == NULL) proc1(); else proc2(); a &gt; b &amp; prt1 ==NULL a &gt; b &amp; prt1 !=NULL a &lt; b &amp; prt1 ==NULL a &lt; b &amp; prt1 !=NULL a == b &amp; prt1 ==NULL a == b &amp; prt1 !=NULL b. if (a &lt; 5 &amp;&amp; b &gt; 7) proc1(); else if (a &lt; 5) proc2(); else if (b &gt; 7) proc3(); else proc4(); a &lt; 5 &amp;&amp; b &gt; 7 a &lt; 5 &amp;&amp; b &lt; 7 a &lt; 5 &amp;&amp; b == 7 a &gt; 5 &amp;&amp; b &gt; 7 a &gt; 5 &amp;&amp; b &lt; 7 a &gt; 5 &amp;&amp; b == 7 a == 5 &amp;&amp; b &gt; 7 a == 5 &amp;&amp; b &lt; 7 a == 5 &amp;&amp; b == 7...
View Full Document

Page1 / 4

homework7 - fragments given on pages 336-337, textbook. a....

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online