ST:(homework 2)
2016-03-05 10:41
246 查看
Below are two faulty programs. Each includes a test case that results in failure. Answer the following questions (in the next slide) about each program.
Questions:
1.Identify the fault.
The left one : i should >= 0,not only > 0;
The right one : is should be " for( int i = x.lenght -1; i >= 0; i--)"
2.If possible, identify a test case that does not execute the fault. (Reachability)
the left one : test: x = []; y =1; expected = -1; actual = -1
the right one : test: x = [] ; expected = -1; actual = -1
3.If possible, identify a test case that executes the fault, but does not result in an error state.
the left one : test: x = [2,3,4];y = 4;expected = 2; actual = 2
the right one: test: x = [0]; expected = 0; actual = 0
4.If possible identify a test case that results in an error, but not a failure.
the left one : test: x = [2,3,4];y = 5;expected = -1; actual = -1
the right one: test: x = [0,3,4]; expected = 0; actual = 0
Questions:
1.Identify the fault.
The left one : i should >= 0,not only > 0;
The right one : is should be " for( int i = x.lenght -1; i >= 0; i--)"
2.If possible, identify a test case that does not execute the fault. (Reachability)
the left one : test: x = []; y =1; expected = -1; actual = -1
the right one : test: x = [] ; expected = -1; actual = -1
3.If possible, identify a test case that executes the fault, but does not result in an error state.
the left one : test: x = [2,3,4];y = 4;expected = 2; actual = 2
the right one: test: x = [0]; expected = 0; actual = 0
4.If possible identify a test case that results in an error, but not a failure.
the left one : test: x = [2,3,4];y = 5;expected = -1; actual = -1
the right one: test: x = [0,3,4]; expected = 0; actual = 0
相关文章推荐
- 微信的优缺点以及发展史
- 阅读计划
- CodeForces 631C Print Check
- 画出一个圆圈的imageview
- Android Studio相关资料
- 关于PreparedStatement.addBatch()方法
- API Guides(七)—— Property Animation To Media Playback
- AFNetworking 上传进度注意事项
- Mysql表操作
- OpenCV学习笔记_图像平滑
- 关于Fragment
- Linux音视频(V4L2运行原理)
- 致敬阿里云
- 从scanf角度看待输入
- echart折线图 柱形图 数据格式化 动态绑定数据 frame处理
- DSP28335— DELAY_US总结
- Codeforces Round #296 (Div. 2) C. Glass Carving
- 内核同步-锁机制
- 跟着开涛学SpringMVC
- Python 基础语法(二)