The program being tested:
BOOLChongfu (intZu[],intIintNum//to test whether Num and the number in the array are duplicated{ if(i==0) { return true; } Else { intx=0, biaoji=1; while(x<i) {if(Zu[x] = =num) {Biaoji=0; Break; } x++; } if(Biaoji = =0) { return false; } Else { return true; } } }voidMain () {intzu1[5]={1,2,3,4,5}; if(Chongfu (ZU1,5,1) ) {cout<<"No Duplicates"<<Endl; } Else{cout<<"There are duplicates"<<Endl; }}
This procedure is to determine if NUM is present in the array zu, I array length
Test process:
zu{1,2,3,4,5} num=1 Result: Duplicate test on boundary data success or not
zu{1,2,3,4,5} num=5 Result: The boundary data is successful or not under repeated tests
zu{1,2,3,4,5} num=3 Result: Duplicate test intermediate data success or not
zu{1,2,3,4,5} num=6 Result: No duplicate test does not exist this data success or not
zu{-1,2,0,-4,5} num=0 Result: Repeat Test 0 for test success
zu{-1,2,0,-4,5} num=-1 Result: There is a repeat test negative number for the test success
zu{-1,2,0,-4,5} num=8 Result: The number of detections does not exist if there are no negative numbers in the test array
zu{1000,2000,5550,-40000,569} num=569 results: The correctness of duplicate test data is relatively large
Test results:
Under the test of many conditions, the program is still correct, and it is preliminarily concluded that the program can be executed correctly.
Arithmetic a module program test