ST Mod3 Chapter10 DataflowTesting Part2
ST Mod3 Chapter10 DataflowTesting Part2
2
1.Program Commission (INPUT,OUTPUT)
`
2.Dim locks,stocks,barrels As Integer
3.Dim lockPrice,stockPrice,barrelPrice As Real
4.Dim totalLocks,totalStocks,totalBarrels As Integer
5.Dim lockSales,stockSales,barrelSales As Real
6.Dim sales,commission:REAL
`
7.lockPrice=45.0
8.stockPrice=30.0
9.barrelPrice=25.0
10.totalLocks=0
11.totalStocks=0
12.totalBarrels=0
13.Input(locks)
14.While NOT(locks=-1)
15.Input (stocks,barrels)
16.totalLocks=totalLocks+locks
17.totalStocks=totalStocks+stocks
18.totalBarrels=totalBarrels+barrels
19.Input(locks)
20.EndWhile 3
21.Output(“Locks sold”,totalLocks)
22.Output(“Stocks sold”,totalStocks)
23.Output(“Barrels sold”,totalBarrels)
`
24.lockSales=lockPrice*totalLocks
25.stockSales=stockPrice*totalStocks
26.barrelSales=barrelPrice*totalBarrels
27.sales=lockSales+stockSales+barrelSales
28.Output(“Total sales”,sales)
`
29.If (sales > 1800.0)
30.Then
31.Commission=0.10*1000.0
32.Commission=commission+0.15*800.0
33.Commission=commission+0.20*(sales-1800.0)
34.Else If(sales > 1000.0)
35.Then
36.Commission=0.10*1000.0
37.Commission=commission+0.15*(sales-1000.0)
38.Else
39.commission=0.10*sales
40.EndIf
41.EndIf
42.Output (“Commission is $”,commission)
`
43.End Commission 4
5
6
39
39
7
11,
8
Du-Paths for Stocks
9
Du-Paths for Locks
10
Du-Paths for totalLocks
11
12
Du-Paths for sales
34,38,39> 13
39
39
39
39 14
du-Path test Coverage Metrics
• The whole point of analyzing a program with definition-use
paths is to define a set of tests coverage metrics known as the
Rapps-Weyuker dataflow testing metrics.
• In the following definitions, T is a set of paths in the program
graph G(P) of a program P, with the set V of variables.
• The cross product of the set of DEF nodes with the set of
USE nodes for a variable to define du-paths, we assume that all
du-paths are feasible.
15
16
17