Chinaunix首页 | 论坛 | 博客
  • 博客访问: 202713
  • 博文数量: 77
  • 博客积分: 1749
  • 博客等级: 上尉
  • 技术积分: 810
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-28 18:27
文章分类
文章存档

2012年(28)

2011年(49)

分类: C/C++

2012-10-16 15:33:13

Testing is not a perfect technique in that a program might contain errors despite the success of a set of tests.

Verification might appear to be perfect technique as it promises to verify that a program is free from errors. However, the person who verified a program might have made mistake in the verification process; there might be an incorrect assumption on the input conditions; incorrect assumptions might be made regarding the components that interface with the program, and so on.  

Verified and published programs have been shown to be incorrect.

Program representation: Control flow graphs

A basic block in  program P is a sequence of consecutive statements with a single entry and a single exit point.  Thus a  block has  unique entry and  exit points. 

Control always enters a basic block at its entry point and exits from its exit point. There is no possibility of exit or a halt at any point inside the basic block except at its exit point. The entry and exit points of a basic block coincide when the block contains only one statement.

A control flow graph  (or flow graph) G is defined as a finite set N of nodes and a finite set E of edges.   An edge (i, j)  in E connects two nodes ni and nj in N.  We often write G= (N, E) to denote a  flow graph G with nodes given by  N  and edges by  E.

In  a flow graph of a program, each basic block  becomes a node and edges are used to indicate  the  flow of control between  blocks. 

Blocks and nodes are labeled such that block bi corresponds to node ni. An edge (i, j) connecting basic blocks bi and bj implies that control can  go from block bi to block bj.  

We also assume that there is a node labeled Start in N that has no incoming edge, and another node labeled End, also in N,  that has no outgoing edge.




阅读(885) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~