《软件测试技术及用例设计实训》源

上传人:第*** 文档编号:33520095 上传时间:2018-02-15 格式:DOCX 页数:12 大小:28.17KB
返回 下载 相关 举报
《软件测试技术及用例设计实训》源_第1页
第1页 / 共12页
《软件测试技术及用例设计实训》源_第2页
第2页 / 共12页
《软件测试技术及用例设计实训》源_第3页
第3页 / 共12页
《软件测试技术及用例设计实训》源_第4页
第4页 / 共12页
《软件测试技术及用例设计实训》源_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《《软件测试技术及用例设计实训》源》由会员分享,可在线阅读,更多相关《《软件测试技术及用例设计实训》源(12页珍藏版)》请在金锄头文库上搜索。

1、P168源程序:#includevoid main()float A,B,X;scanf(“%f%f%f”,if(A1)&(B=0)X=X/A;if(A=2)|(X1)X=X+1;printf(“%f”,X);P171源程序:1. int testing(int x, int y) 2. 3. int software=0; 4. if(x0) & (y0) 5. 6. software = x+y+10; 7. 8. else 9. 10. software = x+y-10; 11. 12. 13. if(software 0)5 6 if (0 = i_flag)7 8 i_temp =

2、 i_count + 100;9 break;10 11 else12 13 if (1 = i_flag)14 15 i_temp = i_temp * 10;16 17 else18 19 i_temp = i_temp * 20;20 21 22 i_count-;23 24 return i_temp;25 P174源程序:1 int _tmain(int argc, _TCHAR* argv)2 3 int x,y; 4 scanf(%d%d, 5 if(x 0 & y 0)6 7 int i = 1; 8 if(x y)9 10 while(x * i)% y != 0)11 i+

3、;12 printf(%dn,x * i);13 14 else15 16 while(y * i)% x != 0)17 i+;18 printf(%dn,y * i);19 20 21 return 0;22 P178源程序:int GetMaxDay( int year, int month )int maxday = 0;if ( month = 1 & month =k+1)printf(“%d is a selected numbern”,m);elseprintf(“%d is not a selected numbern”,m);P218源程序:#include#include

4、void bhdy(int s,int b);void prt();int a4,flag,count;void main()int b1,b2,i,j,k=0,p,c;printf(Game guess your number in mind is # # # #.n);for(i=1;i=inputTotalMoney-2) /若选择A类票且系统足够找零countOfOneYuan= countOfOneYuan- (inputTotalMoney-2);resultOfDeal = Input Informationn + Type: A; Money: 2Yuan n + curren

5、tState(); return resultOfDeal;else if (type.equals(typeOfTickets0) &(countOfOneYuan = inputTotalMoney-4) /若选择B 类票且系统足够找零 countOfOneYuan = countOfOneYuan- (inputTotalMoney-4);resultOfDeal = Input Informationn + Type: B; Money: 2Yuan n + currentState(); return resultOfDeal;else if (type.equals(typeOfT

6、ickets1) &(countOfOneYuan inputTotalMoney-4) /若选择B类票且系统不够找零 resultOfDeal = Not enough Change!; return resultOfDeal;else / 其他状态 返回异常resultOfDeal = Failure Informationn + Money Error;return resultOfDeal;P293源代码:package metroSaleTicket;import junit.framework.Assert;import junit.framework.TestCase;publi

7、c class MetroSaleTicketTest extends TestCase private MetroSaleTicket obj;protected void setUp() throws Exception obj = new MetroSaleTicket();/super.setUp();protected void tearDown() throws Exception super.tearDown();/基本路径1public void testOperation1() String except = Not enough money!; Assert.assertE

8、quals(except,obj.operation(TypeA, 1yuan);/基本路径2public void testOperation2() String except = Input Informationn + Type: A; Money: 2Yuan n + Current Staten +1 Yuan: + 97; Assert.assertEquals(except,obj.operation(TypeA, 5yuan);/基本路径2public void testOperation3() String except = Input Informationn + Type

9、: A; Money: 2Yuan n + Current Staten +1 Yuan: + 92; Assert.assertEquals(except,obj.operation(TypeA, 10yuan);/基本路径4public void testOperation4() String except = Not enough money!; Assert.assertEquals(except,obj.operation(TypeB, 3yuan);/基本路径5public void testOperation5() String except = Input Informatio

10、nn + Type: B; Money: 4Yuan n + Current Staten +1 Yuan: + 99; Assert.assertEquals(except,obj.operation(TypeB, 5yuan);/基本路径5public void testOperation6() String except = Input Informationn + Type: B; Money: 4Yuan n + Current Staten +1 Yuan: + 94; Assert.assertEquals(except,obj.operation(TypeB, 10yuan);/基本路径7public void testOperation7() String except = Failure Informationn + Type Error; Assert.assertEquals(except,obj.operation(TypeC, 10yuan);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号