Posted: January 7th, 2022
The program TriTyp is an old and well-used example from the
unit testing research literature. TriTyp is used as a teaching tool
for the same reasons it has staying power in the literature: the
problem is familiar; the control structure is interesting enough to
illustrate most issues; and it does not use language features that
make this analysis really hard, such as loops and indirect references.
This version of TriTyp is more complicated than some, but that
helps illustrate the concepts. TriTyp is a simple triangle
classification program. Line numbers were added to allow us to refer
to specific decision statements in the answers.
Use TriTyp, a numbered version of which is available on the book
website, to answer the questions below. Only the triang()
method is considered.
(a) List all predicates in the triang() method. Index them by
the line numbers in the program listing
(b) Compute reachability for each of triang()’s predicates.
You may abbreviate the input variables as S1, S2, and S3.
(c) Many of the reachability predicates contain an internal variable
( triOut). Resolve the internal variable in terms of input
variables. That is, determine what values the input variables
need to have to give triOut each possible value.
(d) Rewrite the reachability predicates by solving for triOut.
That is, the reachability predicates should be completely in
terms of the input variables.
(e) Find values for each predicate to satisfy predicate coverage
(PC).
(f) Find values for each predicate to satisfy clause coverage (CC).
(g) Find values for each predicate to satisfy correlated active
clause coverage (CACC).
Place an order in 3 easy steps. Takes less than 5 mins.