Leap year Test

Source: Internet
Author: User

First, the definition of leap year

4 Years a leap, 100 years do not leap, 400 years and leap

Second, demand analysis

The input box is required to enter the year, click the button, a prompt appears. and can handle any input effectively.

Third, test cases

Expected result of content value
Divisible by 400 2400 is a leap year
Divisible by 100 but not divisible by 400 1700 is not a leap year
A leap year, divisible by 4 and not divisible by 100 1964
Not divisible by 4 1931 is not a leap year
Non-numeric character ABC illegal input
Negative number-1234 illegal input
Decimal 2100.5 Illegal input
empty string null illegal input

Iv. Improvement

Using try{}catch{}, and the Parse method

Leap year 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.