DATA FLOW TERMS

5.5 DATA FLOW TERMS

A variable defined in a statement is used in another statement which may occur immediately or several statements after the definition. We are interested in finding paths that include pairs of definition and use of variables. In this section, we explain

a family of path selection criteria that allow us to select paths with varying strength. The reader may note that for every feasible path we can generate a test case. In the following, first we explain a few terms, and then we explain a few selection criteria using those terms.

Global c-use : A c-use of a variable x in node i is said to be a global c-use if x has been defined before in a node other than node i .

Example: The c-use of variable tv in node 9 is a global c-use since tv has been defined in nodes 2 and 5 (Figure 5.4).

Definition Clear Path : A path (i − n 1 −···−n m − j ), m ≥ 0, is called a def- inition clear path (def-clear path) with respect to variable x

• from node i to node j and • from node i to edge (n m ,j)

120 CHAPTER 5 DATA FLOW TESTING

if x has been neither defined nor undefined in nodes n 1 , . . . ,n m . The reader may note that the definition of a def-clear path is unconcerned about the status of x in nodes i and j . Also, a def-clear path does not preclude loops. Therefore, the path 2-3-4-6-3-4-6-3-4-5, which includes a loop, is

a def-clear path. Example: The paths 2-3-4-5 and 2-3-4-6 are def-clear paths with respect

to variable tv from node 2 to 5 and from node 2 to 6, respectively (Figure 5.4).

Global Definition : A node i has a global definition of a variable x if node i has a definition of x and there is a def-clear path with respect to x from node i to some

• node containing a global c-use or • edge containing a p-use of variable x . The reader may note that we do not define global p-use of a

variable similar to global c-use. This is because every p-use is associated with an edge—and not a node.

In Table 5.1, we show all the global definitions and global c-uses appearing in the data flow graph of Figure 5.4; def(i) denotes the set of variables which have global definitions in node i . Similarly, c-use(i) denotes the set of variables which have global c-uses in node i . We show all the predicates and p-uses appearing in the data flow graph of Figure 5.4 in Table 5.2; predicate(i,j) denotes the predicate associated with edge (i, j) of the data flow graph in Figure 5.4; p-use(i, j) denotes the set of variables which have p-uses on edge (i, j).

Simple Path : A simple path is a path in which all nodes, except possibly the first and the last, are distinct.

TABLE 5.1 Def() and c-use() Sets of Nodes in Figure 5.4 Nodes i

def(i)

c-use(i)

1 {value, AS, MIN, MAX}

2 {i, ti, tv, sum}

5 {tv, sum}

{tv, i, sum, value}

{sum, tv}

{av}

5.6 DATA FLOW TESTING CRITERIA

TABLE 5.2 Predicates and p-use() Set of Edges in Figure 5.4 Edges (i, j)

predicate(i, j)

p-use(i, j)

(ti < AS) && (value[i] ! = − 999) {i, ti, AS, value}

(value[i] < = MIN) && (value[i] > = MAX) {i, MIN, MAX, value}

∼ ((value[i] < = MIN) && (value[i] > = MAX)) {i, MIN, MAX, value}

∼ ((ti < AS) && (value[i] ! = − 999)) {i, ti, AS, value}

Example: Paths 2-3-4-5 and 3-4-6-3 are simple paths (Figure 5.4). Loop-Free Path : A loop-free path is a path in which all nodes are distinct.

Complete Path : A complete path is a path from the entry node to the exit node.

Du-path : A path (n 1 −n 2 −···−n j −n k ) is a definition-use path (du-path) with respect to (w.r.t) variable x if node n 1 has a global definition of x and either

• node n k has a global c-use of x and (n 1 −n 2 −···−n j −n k ) is a def-clear simple path w.r.t. x or

• edge (n j ,n k ) has a p-use of x and (n 1 −n 2 −···−n j ) is a def-clear, loop-free path w.r.t. x .

Example: Considering the global definition and global c-use of variable tv in nodes 2 and 5, respectively, 2-3-4-5 is a du-path.

Example: Considering the global definition and p-use of variable tv in nodes 2 and on edge (7, 9), respectively, 2-3-7-9 is a du-path.

Dokumen yang terkait

ANALISIS DANA PIHAK KETIGA PADA PERBANKAN SYARIAH DI INDONESIA PERIODE TRIWULAN I 2002 – TRIWULAN IV 2007

40 502 17

ANALISIS KEMAMPUAN SISWA SMP DALAM MENYELESAIKAN SOAL PISA KONTEN SHAPE AND SPACE BERDASARKAN MODEL RASCH

69 778 11

Analisis Komparasi Internet Financial Local Government Reporting Pada Website Resmi Kabupaten dan Kota di Jawa Timur The Comparison Analysis of Internet Financial Local Government Reporting on Official Website of Regency and City in East Java

19 819 7

STUDI PENJADWALAN DAN RENCANA ANGGARAN BIAYA (RAB) PADA PROYEK PEMBANGUNAN PUSAT PERDAGANGAN CIREBON RAYA (PPCR) CIREBON – JAWA BARAT

34 235 1

PENGARUH PENGGUNAAN BLACKBERRY MESSENGER TERHADAP PERUBAHAN PERILAKU MAHASISWA DALAM INTERAKSI SOSIAL (Studi Pada Mahasiswa Jurusan Ilmu Komunikasi Angkatan 2008 Universitas Muhammadiyah Malang)

127 505 26

AN ANALYSIS OF DESCRIPTIVE TEXT WRITING COMPOSED BY THE HIGH AND THE LOW ACHIEVERS OF THE EIGHTH GRADE STUDENTS OF SMPN SUKORAMBI JEMBER

11 83 16

AN ANALYSIS OF LANGUAGE CONTENT IN THE SYLLABUS FOR ESP COURSE USING ESP APPROACH THE SECRETARY AND MANAGEMENT PROGRAM BUSINESS TRAINING CENTER (BTC) JEMBER IN ACADEMIC YEAR OF 2000 2001

3 95 76

A DISCOURSE ANALYSIS ON “SPA: REGAIN BALANCE OF YOUR INNER AND OUTER BEAUTY” IN THE JAKARTA POST ON 4 MARCH 2011

9 161 13

Improving the Eighth Year Students' Tense Achievement and Active Participation by Giving Positive Reinforcement at SMPN 1 Silo in the 2013/2014 Academic Year

7 202 3

THE INTEGRATION BETWEEN INDONESIA AND WORLD RICE MARKET

1 88 12