CS/CE/SE 6367 Software Testing, Validation and Verification. Lecture 4 Code Coverage (II)

Similar documents
Properties of Integrals, Indefinite Integrals. Goals: Definition of the Definite Integral Integral Calculations using Antiderivatives

We will see what is meant by standard form very shortly

Here we study square linear systems and properties of their coefficient matrices as they relate to the solution set of the linear system.

7.2 The Definite Integral

CS 188: Artificial Intelligence Spring 2007

Lecture 3 ( ) (translated and slightly adapted from lecture notes by Martin Klazar)

Convert the NFA into DFA

Duality # Second iteration for HW problem. Recall our LP example problem we have been working on, in equality form, is given below.

Math Calculus with Analytic Geometry II

1.9 C 2 inner variations

Taylor Polynomial Inequalities

f(x) dx, If one of these two conditions is not met, we call the integral improper. Our usual definition for the value for the definite integral

Fundamental Theorem of Calculus

Nondeterminism and Nodeterministic Automata

Ordinary Differential Equations- Boundary Value Problem

Quadratic Forms. Quadratic Forms

Unit #9 : Definite Integral Properties; Fundamental Theorem of Calculus

Regular expressions, Finite Automata, transition graphs are all the same!!

Linearly Similar Polynomials

Overview of Calculus I

Reasoning with Bayesian Networks

UNIFORM CONVERGENCE. Contents 1. Uniform Convergence 1 2. Properties of uniform convergence 3

Orthogonal Polynomials

Math 520 Final Exam Topic Outline Sections 1 3 (Xiao/Dumas/Liaw) Spring 2008

( dg. ) 2 dt. + dt. dt j + dh. + dt. r(t) dt. Comparing this equation with the one listed above for the length of see that

RELATIONAL MODEL.

Automata and Languages

Summary: Method of Separation of Variables

Recitation 3: More Applications of the Derivative

State space systems analysis (continued) Stability. A. Definitions A system is said to be Asymptotically Stable (AS) when it satisfies

1.1. Linear Constant Coefficient Equations. Remark: A differential equation is an equation

CS 314 Principles of Programming Languages

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

List all of the possible rational roots of each equation. Then find all solutions (both real and imaginary) of the equation. 1.

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

IN GAUSSIAN INTEGERS X 3 + Y 3 = Z 3 HAS ONLY TRIVIAL SOLUTIONS A NEW APPROACH

Calculus of Variations

The Fundamental Theorem of Calculus. The Total Change Theorem and the Area Under a Curve.

CS 275 Automata and Formal Language Theory

1.2. Linear Variable Coefficient Equations. y + b "! = a y + b " Remark: The case b = 0 and a non-constant can be solved with the same idea as above.

Designing finite automata II

First Midterm Examination

Advanced Calculus: MATH 410 Notes on Integrals and Integrability Professor David Levermore 17 October 2004

New Expansion and Infinite Series

The Regulated and Riemann Integrals

Improper Integrals. Type I Improper Integrals How do we evaluate an integral such as

CS 330 Formal Methods and Models

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

2D1431 Machine Learning Lab 3: Reinforcement Learning

Pre-Session Review. Part 1: Basic Algebra; Linear Functions and Graphs

Chapter 5 Plan-Space Planning

The steps of the hypothesis test

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

CS 275 Automata and Formal Language Theory

UNIT 1 FUNCTIONS AND THEIR INVERSES Lesson 1.4: Logarithmic Functions as Inverses Instruction

set is not closed under matrix [ multiplication, ] and does not form a group.

Tests for the Ratio of Two Poisson Rates

Formal Languages and Automata

USA Mathematical Talent Search Round 1 Solutions Year 21 Academic Year

University of Texas MD Anderson Cancer Center Department of Biostatistics. Inequality Calculator, Version 3.0 November 25, 2013 User s Guide

Jim Lambers MAT 169 Fall Semester Lecture 4 Notes

Section 14.3 Arc Length and Curvature

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Student Activity 3: Single Factor ANOVA

Jim Lambers MAT 280 Spring Semester Lecture 26 and 27 Notes

Introduction to Group Theory

Generalized Fano and non-fano networks

Fall 2017 Exam 1 MARK BOX HAND IN PART PIN: 17

New data structures to reduce data size and search time

For a continuous function f : [a; b]! R we wish to define the Riemann integral

4 7x =250; 5 3x =500; Read section 3.3, 3.4 Announcements: Bell Ringer: Use your calculator to solve

Properties of the Riemann Integral

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Spring 2017 Exam 1 MARK BOX HAND IN PART PIN: 17

1 Probability Density Functions

Chapter 2 Finite Automata

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

MAA 4212 Improper Integrals

19 Optimal behavior: Game theory

Reasoning and programming. Lecture 5: Invariants and Logic. Boolean expressions. Reasoning. Examples

Improper Integrals, and Differential Equations

Example Sheet 6. Infinite and Improper Integrals

Lecture 3: Equivalence Relations

12 TRANSFORMING BIVARIATE DENSITY FUNCTIONS

Review of Riemann Integral

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

Best Approximation in the 2-norm

38 Riemann sums and existence of the definite integral.

Topic 1 Notes Jeremy Orloff

Minimal DFA. minimal DFA for L starting from any other

Normal Distribution. Lecture 6: More Binomial Distribution. Properties of the Unit Normal Distribution. Unit Normal Distribution

Conservation Law. Chapter Goal. 5.2 Theory

1 2-D Second Order Equations: Separation of Variables

CS5371 Theory of Computation. Lecture 20: Complexity V (Polynomial-Time Reducibility)

Read section 3.3, 3.4 Announcements:

The graphs of Rational Functions

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

A Matrix Algebra Primer

Riemann Sums and Riemann Integrals

Definite integral. Mathematics FRDIS MENDELU

Transcription:

CS/CE/SE 6367 Softwre Testing, Vlidtion nd Verifiction Lecture 4 Code Coverge (II)

2/54 Lst Clss Code coverge Control-flow coverge Sttement coverge Brnch coverge Pth coverge Coverge Collection Tools EclEmm

3/54 This Clss Code coverge Dt-flow coverge All-Defs All-Uses All-DU-Pths All-P-Uses/Some-C-Uses All-C-Uses/Some-P-Uses All-P-Uses All-C-Uses

4/54 Motivtion t1 t2 Are t1 nd t2 identicl? lthough the pths re the sme, different tests my hve different vrible vlues defined/used Bsic ide: Control-flow grph Existing control-flow coverge criteri only consider the execution pth (structure) In the progrm pths, which vribles re defined nd then used should lso be covered (dt) A fmily of dtflow criteri is then defined, ech providing different degree of dt coverge

5/54 Dtflow Coverge Considers how dt gets ccessed nd modified in the system nd how it cn get corrupted Common ccess-relted bugs Using n undefined or uninitilized vrible Dellocting or reinitilizing vrible before it is constructed, initilized, or used Deleting collection object leving its members unccessible (grbge collection helps here) Uninitilized... List l; l.dd("1");... Exception in thred "min" jv.lng.nullpointerexception t dtflow.temp.min(temp.jv:21)

6/54 Vrible Definition A progrm vrible is DEFINED whenever its vlue is modified: on the left hnd side of n ssignment sttement e.g., y = 17 in n input sttement e.g., red(y) s n cll-by-reference prmeter in subroutine cll e.g., updte(x, &y);

7/54 Vrible Use A progrm vrible is USED whenever its vlue is red: on the right hnd side of n ssignment sttement e.g., y = x+17 s n cll-by-vlue prmeter in subroutine or function cll e.g., y = sqrt(x) in the predicte of brnch sttement e.g., if ( x > 0 ) { }

8/54 Vrible Use: p-use nd c-use Use in the predicte of brnch sttement is predicteuse or p-use Any other use is computtion-use or c-use For exmple, in the progrm frgment: if ( x > 0 ) { } print(y); There is p-use of x nd c-use of y

9/54 Vrible Use A vrible cn lso be used nd then re-defined in single sttement when it ppers: on both sides of n ssignment sttement e.g., y = y + x s n cll-by-reference prmeter in subroutine cll e.g., increment( &y )

10/54 More Dtflow Terms nd Definitions A pth is definition cler ( def-cler ) with respect to vrible v if it hs no vrible re-definition of v on the pth A complete pth is pth whose initil node is entry node nd whose finl node is n exit node p1 p2 p3 red(x,v); if(x>0) x=v+1; v=v+1; p1 is def-cler for v, while p2 is not p1, p2 re not complete, while p3 is return x+v Control-flow grph

11/54 Definition-Use Pir (DU-Pir) A definition-use pir ( du-pir ) with respect to vrible v is pir (d,u) such tht d is node defining v u is node or edge using v when it is p-use of v, u is n outgoing edge of the predicte sttement there is def-cler pth with respect to v from d to u def d no def for v c-use u c-use exmple def p-use d no def for v u p-use exmple

12/54 DU-Pir: Exmple 1 1. input(a,b) if (B>1) { input(a,b) if(b>1) B>1 2. A = A+7 } B<=1 A=A+7 3. if (A>10) { 4. B = A+B if(a>10) A>10 } A<=10 B=A+B 5. output(a,b) output(a,b)

13/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

14/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

15/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

16/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

17/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

18/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

19/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

20/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

21/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

22/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

23/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

24/54 Identifying DU-Pirs Vrible A 1. du-pir input(a,b) pth(s) (1,2) if (B>1) <1,2> { 2. (1,4) A = A+7 <1,3,4> (1,5) } <1,3,4,5> 3. if (A>10) <1,3,5> { 4. (1,<3,4>) B = A+B <1,3,4> (1,<3,5>) } <1,3,5> 5. (2,4) output(a,b) <2,3,4> (2,5) <2,3,4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 B>1 A=A+7 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> (2,<3,5>) <2,3,5> output(a,b)

25/54 Identifying DU-Pirs Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a,b) B>1 A=A+7 A>10 B=A+B

26/54 Identifying DU-Pirs Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a,b) B>1 A=A+7 A>10 B=A+B

27/54 Dtflow Test Coverge Criteri All-Defs for every progrm vrible v, t lest one def-cler pth from every definition of v to t lest one c-use or one p-use of v must be covered

28/54 Dtflow Test Coverge Criteri Consider test cse executing pth: t1: <1,2,3,4,5> Identify ll def-cler pths covered (i.e., subsumed) by this pth for ech vrible Are ll definitions for ech vrible ssocited with t lest one of the subsumed def-cler pths?

29/54 Def-Cler Pths subsumed by <1,2,3,4,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>

30/54 Def-Cler Pths Subsumed by <1,2,3,4,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B

31/54 Dtflow Test Coverge Criteri Since <1,2,3,4,5> covers t lest one def-cler pth from every definition of A or B to t lest one c-use or p-use of A or B, All-Defs coverge is chieved

32/54 Dtflow Test Coverge Criteri All-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use nd every p-use (including ll outgoing edges of the predicte sttement) of v must be covered Requires tht ll du-pirs covered Consider dditionl test cses executing pths: t2: <1,3,4,5> t3: <1,2,3,5> Do ll three test cses provide All-Uses coverge?

33/54 Def-Cler Pths Subsumed by <1,3,4,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>

34/54 Def-Cler Pths Subsumed by <1,3,4,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B

35/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>

36/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible A du-pir pth(s) (1,2) <1,2> (1,4) <1,3,4> (1,5) <1,3,4,5> <1,3,5> input(a,b) if(b>1) B<=1 B>1 A=A+7 (1,<3,4>) <1,3,4> (1,<3,5>) <1,3,5> (2,4) <2,3,4> (2,5) <2,3,4,5> if(a>10) A<=10 A>10 B=A+B <2,3,5> (2,<3,4>) <2,3,4> output(a, (2,<3,5>) <2,3,5>

37/54 Def-Cler Pths Subsumed by <1,2,3,5> for Vrible B du-pir pth(s) (1,4) <1,2,3,4> <1,3,4> (1,5) <1,2,3,5> <1,3,5> (1,<1,2>) <1,2> (1,<1,3>) <1,3> (4,5) <4,5> input(a,b) if(b>1) B<=1 if(a>10) A<=10 output(a, B>1 A=A+7 A>10 B=A+B

38/54 Dtflow Test Coverge Criteri None of the three test cses covers the du-pir (1,<3,5>) for vrible A, All-Uses Coverge is not chieved

39/54 DU-Pir: More Complicted Exmple 1. input(x,y) 2. while (Y>0) { 3. if (X>0) 4. Y := Y-X else 5. input(x) 6. } 7. output(x,y) input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 } n7 output(x,y)

40/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y

41/54 du-pir Identifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 n7 } output(x,y

42/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y

43/54 ()* mens will be repeted for >=1 times du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y

44/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y

du-pir Identifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> Infesible! input(x,y) while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 Y:=Y-X input(x) n6 n7 } output(x,y 45/54 Note tht the definition of dupir does not require the existence of fesible def-cler pth from d to u

46/54 du-piridentifying pth(s) DU-Pirs Vrible X (1,4) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,7) <1,2,7> <1,2,(3,4,6, 2)*,7> input(x,y) (1,<3,4>) <1,2,3,4> <1,2,3,4,(6,2,3,4)*> (1,<3,5>) <1,2,3,5> <1,2,3,5,(6,2,3,5)*> (5,4) <5,6,2,3,4> while(y>0) Y>0 Y<=0 if(x>0) X>0 X<=0 <5,6,2,3,4,(6,2,3,4)*> Y:=Y-X input(x) (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5> n6 n7 } output(x,y

47/54 More Dtflow Terms nd Definitions A pth (either prtil or complete) is simple if ll edges within the pth re distinct, i.e., different A pth is loop-free if ll nodes within the pth re distinct, i.e., different

48/54 Simple nd Loop-Free Pths pth Simple? Loop-free? <1,3,4,2> <1,2,3,2> <1,2,3,1,2> <1,2,3,2,4>

49/54 DU-Pth A pth <,,...,nj,nk> is du-pth with respect to vrible v, if v is defined t node nd either: there is c-use of v t node nk nd <,,...,nj,nk> is def-cler simple pth, or there is p-use of v t edge <nj,nk> nd <,,...nj> is def-cler loop-free pth. NOTE!

50/54 Identifying DU-Pths du-pir pth(s) du-pth? (5,4) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,7) <5,6,2,7> <5,6,2,(3,4,6,2)*,7> (5,<3,4>) <5,6,2,3,4> <5,6,2,3,4,(6,2,3,4)*> (5,<3,5>) <5,6,2,3,5> <5,6,2,(3,4,6,2)*,3,5>

51/54 Another Dtflow Test Coverge Criterion All-DU-Pths: for every progrm vrible v, every du-pth from every definition of v to every c-use nd every p-use of v must be covered p1 2 def 1 3 p2 p1 stisfies ll-defs nd ll-uses, but not ll-du-pths p1 nd p2 together stisfy ll-du-pths 4 c-use node 1 is the only def node, nd 4 is the only use node for v

52/54 More Dtflow Test Coverge Criteri All-P-Uses/Some-C-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every p-use of v must be covered If no p-use of v is vilble, t lest one def-cler pth to c-use of v must be covered All-C-Uses/Some-P-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use of v must be covered If no c-use of v is vilble, t lest one def-cler pth to p-use of v must be covered

53/54 More Dtflow Test Coverge Criteri (2) All-P-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every p-use of v must be covered All-C-Uses: for every progrm vrible v, t lest one def-cler pth from every definition of v to every c-use of v must be covered

54/54 Summry Pth Coverge All-DU-Pths All-Uses All-P-Uses/Some-C-Uses All-C-Uses/Some-P-Uses All-P-Uses All-Defs All-C-Uses Brnch Coverge Sttement Coverge

55/54 Suggested Redings Sndr Rpps nd Eline J. Weyuker. Selecting Softwre Test Dt Using Dt Flow Informtion. IEEE Trnsctions on Softwre Engineering, 11(4), April 1985, pp. 367-375. http://ieeexplore.ieee.org/stmp/stmp.jsp? tp=&rnumber=1702019 P. Frnkl nd E. Weyuker. An Applicble Fmily of Dt Flow Testing Criteri. IEE Trnsction on softwre eng., vol.14, no.10, October 1988. E. Weyuker. The evlution of Progrm-bsed softwre test dt dequcy criteri. Communiction of the ACM, vol.31, no.6, June 1988. Softwre Testing: A Crftsmn s Approch.2nd CRC publiction, 2002

56/54 Thnks