- 3
- 0
- 约3.55千字
- 约 7页
- 2019-05-17 发布于浙江
- 举报
NextDate函数黑盒测试
1测试程序源代码
#include iostream
using namespace std;
void NextDate(int year,int month,int day);
void main()
{
int year=0,month=0,day=0;
NextDate(year,month,day);
}
void NextDate(int year,int month,int day)
{
cout请输入年份:endl;
cinyear;
while(!(year=1811 year=2013))
{
cout年份超过界限,请重新输入endl;
cinyear;
}
cout请输入月份:endl;
cinmonth;
while (month12||month1)
{
cout月份输入有误,请重新输入endl;
cinmonth;
}
cout请输入日期:endl;
cinday;
while (day31||day1)
{
cout日期输入有误,请重新输入endl;
cinday;
}
if((year%4==0 year%100!=0) || (year%400==0)) //检查闰年;
{
int i=0;
i=day-29;
while(month==2i0)
{
cout本月是闰月,请在1-29之间从新输入日期endl;
cinday;
}
if(month==2day==29)
{
month=3;
day=1;
}
else day++;
}
else day++;
//月底计算;
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
if (day==32)
{
month++;
day=1;
cout明天是:year/month/dayendl;
}
break;
case 2:
if(day==29)
{
month=3;
day=1;
cout明天是:year/month/dayendl;
}
break;
case 4:
case 6:
case 9:
case 11:
if(day==31)
{
month++;
day=1;
cout明天是:year/month/dayendl;
}
break;
case 12:
if(day==32)
{
year++;
month=1;
day=1;
cout明天是:year/month/dayendl;
}
break;
}
cout明天是:year/month/dayendl;
}
2测试用例设计
利用等价类划分法设计测试用例
输入条件
编号
有效等价类
编号
无效等价类
输入年份
⑴
1812=年=2012
⑺
年1812
⑻
年2012
输入月份
⑵
1=月份=12
⑼
月1
⑽
月12
输入日期
⑶
1=日期=31
⑾
日期1
⑿
日期31
输入类型
⑷
输入为int型
⒀
除int型外的任意输入
输入为闰年
⑸
输入2月29日
⒁
输入为闰年2月30日
输入为平年
⑹
输入2月28日
⒂
输入2月29日
3测试执行情况与记录
测试用例编号
输入
输出
覆盖等价类
1
1988/2/3
1988/2/4
⑴⑵⑶⑷
2
2000/2/29
2000/3/1
⑸
3
2001/2/28
2001/3/1
⑹
4
100/1/23
年份输入有误,请重新输入
⑺
5
2300/3/2
年份输入有误,请重新输入
⑻
6
1912/0/3
月份输入有误,请重新输入
⑼
7
1927/90/3
月份输入有误,请重新输入
⑽
8
1856/3/-21
日期输入有误,请重新输入
⑾
9
1872/3/43
日期输入有误,请重新输入
⑿
10
Dasd@#¥%asdasdasd……%ffgwgrwgrerhsxcvxfgdfg
程序进入死循环
⒀
11
2000/2/30
本月是闰月,请在1-29之间从新输入日期
⒁
12
2001/2/29
2001/2/30
⒂
#include iostream
using namespace std;
void NextDate(int year,int month,int day);
void main()
您可能关注的文档
- 3以内加减.ppt
- 4.1.民航服务人员的态度及培养.ppt
- 4-拜占庭家具.ppt
- 3陈述句与感叹句互换.ppt
- 4.《资本论》第三篇.pptx
- 4.安全工作例会制度.pdf
- 4-2《人类认识地球及运动的历史》.ppt
- 4安全生产管理目标分解书.doc
- 4SBS防水卷材技术交底.docx
- 5-1收心迎期中班会.ppt
- 全过程工程管理造价咨询工程监理项目服务方案投标方案(技术部分).doc
- 招标代理服务投标技术服务方案(技术方案).doc
- AI大模型与AIGC技术在公安领域的应用解决方案(99页 PPT).pptx
- 工业4.0智能制造数字工厂规划方案.pptx
- 树立社会主义核心价值观.docx
- 三年(2023-2025)中考历史真题分类汇编(全国)专题21 科技文化与社会生活(解析版).docx
- 2025年中考道德与法治真题完全解读(吉林卷).pdf
- 2025年中考道德与法治真题完全解读(安徽卷).pdf
- 三年(2023-2025)中考历史真题分类汇编(全国)专题14 人民解放战争(解析版).pdf
- 三年(2023-2025)广东中考历史真题分类汇编:专题03 中国近代史(八年级上册)(解析版).docx
最近下载
- 2026届四川省成都市石室中学化学高一第一学期期末综合测试试题含解析.doc
- 维修电工技师高级技师理论复习资料.pdf VIP
- 山东省菏泽市2024-2025学年高一下学期期末考试含答案(10科试卷).pdf
- 新员工岗前公司级安全考试(重庆轨道交通-B卷).docx VIP
- 装备修理质量管理课件.pptx VIP
- 螺杆机-海信螺杆式风冷热泵机组.pdf VIP
- 诱导性多功能干细胞研究行业深度调研及发展策略研究报告.docx
- 湖南省长沙市长郡中学2024-2025学年高一上学期期末考试语文试卷(含答案).pdf VIP
- 关于高三综评典型事例摘抄.docx VIP
- 装备修理技术与信息管理.pptx VIP
原创力文档

文档评论(0)