Selecting Input Data for Fault Sensitization

10.4.2 Selecting Input Data for Fault Sensitization

For the sake of this discussion, we introduce a program label that indicates the first executable statement of the program, and we refer to it as the begin label. Also, we consider a Boolean expression E and designate the program label where this expression is evaluated by L. We consider a possible fault in expression E (among the classes of faults catalogued in Section 10.4.1) and we let E be the expression obtained from E when the fault is removed; also, we let C be the sensitization condi- tion of the targeted fault at E, that is, C = E E . We have the following criterion:

We say that initial state s sensitizes the targeted fault in the Boolean expression E if and only if:

• There exists a path p from label begin to label L; let P be the function of p (computed as shown in Section 10.1). • The post-restriction of P to sensitization condition C is not empty. • State s is in the domain of the post-restriction of P to sensitization condition C.

As an illustrative example, we consider an array a of size 2 × N for some natural number N greater than 1 and an element x of the same data type as the contents of the array; we assume that we are interested in checking whether x is in the first half of the array. Hence we write the following program:

226 STRUCTURAL CRITERIA

void main () {itemtype a[2*N]; itemtype x; indextype i; bool found; i=0; L: while ((a[i]!=x) && (i<=N)) {i=i+1;} found = (a[i-1]==x);}

We have a relational operator fault in this program, as the loop condition should read ((a[i]!=x) && (i<N)) rather than ((a[i]!=x) && (i<=N)). As we discuss in the previous section, this fault can be sensitized locally by ensuring that (i<=N) holds while (i<N) does not, and ensuring that (a[i]!=x)is true. To this effect, we let i be equal to N while ensuring that the condition (a[N]!=x) is true. We write the local sensitization condition as:

C≡i=N

aN x

All these are local conditions; we must now determine what input data will create these local conditions at label L? To this effect, we compute a path from the start of the program to label L, take its post-restriction to the sensitization condition, check that it is nonempty, then compute its domain. We find:

Path: i=0; ((((a[i]!=x) && (i<=N))? True) ; {i=i+1})*;

where the * is used to refer to an arbitrary number of instances of a path. The function of this path is given by the following formula (where the star represents reflexive tran- sitive closure):

P = {Substitution}

s, s i = 0 − s = − s • s,s a i x i ≤ N i = i + 1− s = − s = {Transitive Closure}

s, s i = 0 − s = − s • s,s j0≤j<iajxj≤Ni≥i−s=−s = {Relational Product} s, s j0≤j<iajxj≤Ni≥0−s=−s = {Simplification} s, s i ≥ 0 − s = − s i≤N+1 j0≤j<iajx

10.4 FAULT-BASED TEST GENERATION 227

Taking the post-restriction of this function to the sensitization condition, we find P•I C

= {Substitution} s,s i ≥ 0 − s = − s i≤N+1 i=N

aN x j0≤j<iajx = {Simplification}

s,s − s = − s

i=N

j0≤j≤Najx

The domain of this function is:

dom P•I C = s j 0 ≤ j ≤ N a j x

Any initial state in this domain will sensitize the fault: Indeed, since the condition aj x holds for all indices between 0 and N inclusive, the second conjunct of the while condition determines the value of this condition: For i=N, the condition (i<=N) returns True, whereas the condition (i<N) returns False.

Dokumen yang terkait

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

ANTARA IDEALISME DAN KENYATAAN: KEBIJAKAN PENDIDIKAN TIONGHOA PERANAKAN DI SURABAYA PADA MASA PENDUDUKAN JEPANG TAHUN 1942-1945 Between Idealism and Reality: Education Policy of Chinese in Surabaya in the Japanese Era at 1942-1945)

1 29 9

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

Improving the VIII-B Students' listening comprehension ability through note taking and partial dictation techniques at SMPN 3 Jember in the 2006/2007 Academic Year -

0 63 87

The Correlation between students vocabulary master and reading comprehension

16 145 49

Improping student's reading comprehension of descriptive text through textual teaching and learning (CTL)

8 140 133

The correlation between listening skill and pronunciation accuracy : a case study in the firt year of smk vocation higt school pupita bangsa ciputat school year 2005-2006

9 128 37

Perancangan Sistem Informasi Akuntansi Laporan Keuangan Arus Kas Pada PT. Tiki Jalur Nugraha Ekakurir Cabang Bandung Dengan Menggunakan Software Microsoft Visual Basic 6.0 Dan SQL Server 2000 Berbasis Client Server

32 174 203

Pengaruh Kualitas Software Aplikasi pengawasan kredit (C-M@X) Pt.PLN (PERSERO) Distribusi Jawa Barat Dan Banten (DJBB) Terhadap Produktivitas Kerja karyawan UPJ Bandung Utara

5 72 130

Transmission of Greek and Arabic Veteri

0 1 22