[Careercup] 12.3 Test Move method in a Chess game test how to move in a chess game

Source: Internet
Author: User

12.3 We have the following method used in a chess game:boolean canmoveto (int x, int y). This method was part of the Piece class and returns whether or not the Piece can move to position (x, y). Explain Howyou would test this method.

This question lets us test the movement method in the Chess game Boolean canmoveto (int x, int y), this method determines whether the piece can be moved to (x, y) position. This type of problem usually has two kinds of test methods, extremum test and routine test.

Extremum testing: We need to test for some bad conditions that may cause a program to crash, such as

1. Detection of negative values for X and Y

2. Detect when x exceeds the checkerboard width

3. Detect when Y exceeds the board height

4. Detect a full board

5. Detect an empty board, or an approximate empty board

6. Detection of white pieces larger than black pieces

7. Detection of black pieces larger than the white pieces of the situation

General testing: It can be very time-consuming to detect all situations, so we only detect parts of the area.

[Careercup] 12.3 Test Move method in a Chess game test how to move in a chess game

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.