| summergroup2008's profile软件实现技术小组BlogListsNetwork | Help |
|
|
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; TrackbacksThe trackback URL for this entry is: http://summergroup2008.spaces.live.com/blog/cns!967FF480A02B062F!165.trak Weblogs that reference this entry
|
|
|