Two Pillars 3 unit test

Source: Internet
Author: User

This test is divided into the following stages:
Note: a[0],a[1],a[2],a[3],a[4],a[5],a[6] indicate the number of topics, whether there is a multiplication method. The range of operands, whether the result has a negative value, the number of columns printed, the number of intervals to enter per row
First: Test whether the problem is repeated
Because the Srand function is referenced in the program, and the header file is written, so the basic will not be wrong, the problem will not be repeated, unless the situation, that is, if the range of random numbers and the number of topics is not established, it is possible to have the following situations, which is the function of the failure, there is a contradiction.
(Fig. 1)
Second: The input conditions do not meet the requirements, the program error handling
The program takes into account the user input does not meet the requirements, so need to make a judgment on the input results, the following is the program run, you can prove that the program can be verified.
(Fig. 2)
Third: Question Time
When the number of the question Tens, 100,000, million, the question Time is very long, affect performance!
(Fig. 3) The number of test data is 10,000, in part as follows
IV: Test data
Verify the program by testing several sets of data.
(Fig. 4, fig. 5)
Figure 1:a[1]=1;a[2]=20;


Figure 2:


Figure 3:a[0]=10000;


Figure 4: A case of division


Fig. 5: The situation of the surplus number; Figure 4,5 is the normal condition.


Figure 6:a[6]=7 When there is an exception, no workaround is found


Figure 7:a[6]=6 When the situation is abnormal, the number of individuals think the maximum column is five columns, but the program did not find the restrictions

It is summarized as follows: The test unit can make our program more perfect, find problems and shortcomings, after testing, the problem of the program now is the output column number is a problem, this is a small flaw

In 0-5, you can output the number of columns, but beyond 5, it is not normal, but there are regular, I think, may be because the output panel size is limited, the number of characters per line can only be entered, so in order to make the program more robust, so this is a small bug, you can add a restriction, control within 5, It's settled.

Two Pillars 3 unit test

Related Article

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.