PROCEDURE average: - PowerPoint PPT Presentation

About This Presentation
Title:

PROCEDURE average:

Description:

Basis Path Testing - Example PROCEDURE average: This procedure computes the average of 100 or fewer numbers that lie between bounding values; it also computes the sum ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 7
Provided by: modified6
Category:

less

Transcript and Presenter's Notes

Title: PROCEDURE average:


1
Basis Path Testing - Example
  • PROCEDURE average
  • This procedure computes the average of 100 or
    fewer numbers that lie between bounding values
    it also computes the sum and the total number
    valid
  • INTERFACE returns average, total.input,
    total.valid
  • INTERFACE accepts value, minimum, maximum
  • TYPE value1100 IS SCALAR ARRAY
  • TYPE average, total.input, total.valid,
    minimum,maximum,sum IS SCALAR
  • TYPE i is integer
  • i1
  • total.input total.valid 0
  • Sum0
  • Do while valueiltgt-999 and total.input lt 100
  • increment total.input by 1
  • IF valuei gt minimum and valuei ltmaximum
  • THEN increment total.valid by 1
  • sum sum valueI
  • ENDIF
  • increment i by 1
  • Enddo

2
Basis Testing Example
3
Basis Testing Example
  • Compute cyclomatic complexity
  • V(G) 17 edges 13 nodes 2 6
  • Determine sets of independent paths
  • 1 1-2-10-11-13
  • 2 1-2-10-12-13
  • 3 1-2-3-10-11-13
  • 4 1-2-3-10-12-13
  • 5 1-2-3-4-5-8-9-2-
  • 6 1-2-3-4-5-6-8-9-2-.
  • Or is it???

4
Correction
  • Oops, the previous page is WRONG.
  • Determine set of independent paths
  • 1 1-2-10-11-13
  • 2 1-2-3-10-12-13
  • 3 1-2-3-4-5-8-9-2-
  • 4 1-2-3-4-5-6-8-9-2-
  • 5 1-2-3-4-5-6-7-8-9-2-
  • Why arent there six?

5
Basis Testing - Example
  • Prepare Test Cases for each
  • Test case path 1
  • Value(k) is value k lt i i gt 2 i lt100
  • Value i -999 same range
  • Expected result correct average based on k
    values and proper totals
  • Test case path 2
  • Value(1) -999
  • Expected results average -999 other totals
    are the initial values
  • Test case path 3
  • Attempt to process 101 or more values
  • First 100 should be valid
  • Expected results as test case 1

6
Basis Testing Example
  • Test case path 4
  • Value(i) valid input where i lt 100
  • Value(k) lt minimum where k lt i
  • Expected results correct average based on k
    values and proper totals
  • Test case path 5
  • Value (i) valid input where i lt 100
  • Value(k) gt maximum where ki
  • Expected results correct average based on n
    values and proper totals
  • Test case path 6
  • Value(i) valid input where i lt 100
  • Expected results correct average based on n
    values and proper totals
Write a Comment
User Comments (0)
About PowerShow.com