Skip to main content

Example - insert sort

Task 1

Section

9.2.2. Example

Let's reconsider the BubbleSort function from the previous chapter and create test cases for it that satisfy the branch coverage criterion.

Step 1. Define the subject and test elements. The test element is the SortBąbelkowe function.

ET1: Bubble Sort.

Step 2 and 3. Derivation of test conditions and coverage elements.

The test conditions and at the same time the coverage elements are the edges of the Textbook,control upflow tograph.
the

figure
WT1=EP1: (B1, B2); WT5=EP5: (B5, B4); WT9=EP9: (B7, B2);
WT2=EP2: (B2, B3); WT6=EP6: (B6, B4); WT10=EP10: (B7, B8).
WT3=EP3: (B3, B5); WT7=EP7: (B4, B3);
WT4-EP4: (B5, B6); WT8=EP8: (B3, B7);

These elements are shown graphically in Figure 9.2.

Task 2

Control Flow Graph for the insertSort with labeled graph edges.