Arithmetic a module program test

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.