Skip to Content
Computers as Components, 2nd Edition
book

Computers as Components, 2nd Edition

by Marilyn Wolf
July 2008
Intermediate to advanced
544 pages
16h 52m
English
Morgan Kaufmann
Content preview from Computers as Components, 2nd Edition
5.10 Program Validation and Testing 273
Example 5.13
Condition testing with the branch testing strategy
Assume that the code below is what we meant to write.
if (a || (b >= c)) { printf("OK\n"); }
The code that we mistakenly wrote instead follows:
if (a && (b >= c)) { printf("OK\n"); }
If we apply branch testing to the code we wrote, one of the tests will use these values: a =0,
b =3,c = 2 (making a false and b >= c true). In this case, the code should print the OK term
[0 || (3 >= 2) is true] but instead doesn’t print [0 && (3 >= 2) evaluates to false]. That test
picks up the error.
Let’s consider another more subtle error that is nonetheless all too ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computers as Components, 3rd Edition

Computers as Components, 3rd Edition

Marilyn Wolf
Computer System Designs: System-on-Chip

Computer System Designs: System-on-Chip

Michael J. Flynn, Wayne Luk
PC Hardware in a Nutshell, 3rd Edition

PC Hardware in a Nutshell, 3rd Edition

Robert Bruce Thompson, Barbara Fritchman Thompson

Publisher Resources

ISBN: 9780123743978