"Software Test" class Note 01

Source: Internet
Author: User

/*

void Main (void) {

Char AAA;

while (1) {

if (onesecondpassed ()) aaa++;

if (AAA >200) {

Class_is_over ();

}else{

Lesson_to_lecture ();

}

}

}

*/

This is a simple code for C + +

Function: Realize second time, more than 200s when class, otherwise listen.

Class_is_over (), Lesson_to_lecture (), onesecondpassed () can work properly

The above code has several errors.

1. Char AAA We all know that the range of char is -128~127, and the following if statement may cause AAA to appear with a value greater than 127.

2. aaa++ may cause an AAA overflow.

3. It is very likely that the loop inside the mouth will not jump out at the end.

The above basically belongs to some simple mistakes. As we all know, this simple error is often the cause of some unpredictable loss. Therefore, software testing is an indispensable link.

For most language beginners, the value range, usage, looping, looping nesting of each variable, and the use of some functions are the basic common sense that should be mastered, and we develop the habit of instant testing, and don't wait until all the code is complete before you start testing.

"Software Test" class Note 01

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.