summergroup2008's profile软件实现技术小组BlogListsNetwork Tools Help

Blog


    July 20

    主要测试用例代码及注释1

    #include "Elevator.h"
    #include <stdio.h>
    const int count=21;  //the number of test cases
    bool testcases[count]; //record whether every test case is passed or failed
    void main()
    {
     /*********************************************************
     basic testing according to some functions
     测试电梯运行时的显示和停止时的显示
     从1层到10层,又从10层下到1层
     **********************************************************/
     Elevator elevator;
     Elevator *ep=&elevator;
     //test case1
     cout<<"test1:测试从1层到9层运行中的电梯状态是否正确"<<endl;
     elevator.RequireUp(1);
     elevator.mysleep(ONESEC*3); //3s开门等待乘客进入
     elevator.CloseDoor();
     elevator.mysleep(ONESEC); //等待关门
     elevator.RequireGetOff(10); //请求上到10层
     int num1=0;
     for(int i=1;i<=8;i++)
     {
      elevator.mysleep(ONESEC*3); //3s上升一层
      cout<<"第"<<i+1<<"层";
      if(elevator.GetElevatorState()==::ES_CLOSED&&elevator.GetElevatorDirection()==::ED_UP&&elevator.GetArrivedFloor()==i+1)
      {
       cout<<"passed";
       num1++;
      }
      else cout<<"failed";
      cout<<endl;
     }
     if(num1==8) testcases[0]=true;

    Comments

    Please wait...
    Sorry, the comment you entered is too long. Please shorten it.
    You didn't enter anything. Please try again.
    Sorry, we can't add your comment right now. Please try again later.
    To add a comment, you need permission from your parent. Ask for permission
    Your parent has turned off comments.
    Sorry, we can't delete your comment right now. Please try again later.
    You've exceeded the maximum number of comments that can be left in one day. Please try again in 24 hours.
    Your account has had the ability to leave comments disabled because our systems indicate that you may be spamming other users. If you believe that your account has been disabled in error please contact Windows Live support.
    Complete the security check below to finish leaving your comment.
    The characters you type in the security check must match the characters in the picture or audio.

    To add a comment, sign in with your Windows Live ID (if you use Hotmail, Messenger, or Xbox LIVE, you have a Windows Live ID). Sign in


    Don't have a Windows Live ID? Sign up

    Trackbacks

    The trackback URL for this entry is:
    http://summergroup2008.spaces.live.com/blog/cns!967FF480A02B062F!165.trak
    Weblogs that reference this entry
    • None