现在的位置: 首页 > 综合 > 正文

语言新思路:接口+测试

2011年03月01日 ⁄ 综合 ⁄ 共 353字 ⁄ 字号 评论关闭

 

顾名思义,就是接口加上测试代码。

 

任何符合这个接口的,除了接口样式要对应之外,同时还要运行通过测试。

 

interface iphone

{

       void call(string number):

   test{ ... } ;

}

 

class Nokia : iphone

{

            void call(string number){...} 

 

class Motorola : iphone

{

          void call(string number){...} 

}

 

Nokia E72 = new Nokia();  

E72.call("114"); // test ...

 

Motorola V8 = new Motorola();

V8.call("110"); //test...

 

这样,我们就可以根据接口来测试项目,而不依赖具体的实现了。

 

 

 

 

 

抱歉!评论已关闭.