实验内容: 1 package sizeyunsuan; 2 3 import static org.junit.Assert.*; 4 5 import org.junit.Test; 6 7 public class SiZeYunSuanTest { 8 9 ...
分类:
其他好文 时间:
2015-05-08 20:03:04
阅读次数:
88
二值化,利用大律法实现自适应二值化,自动求出二值化阈值
int BinarizeImageByOTSU (IplImage * src)
{
assert(src != NULL);
//get the ROI
CvRect rect = cvGetImageROI(src);
//information of the source image
int x = rect.x;
...
分类:
其他好文 时间:
2015-05-08 13:03:17
阅读次数:
130
断言的概念断言用于证明和测试程序的假设,比如“这里的值大于 5”。断言可以在运行时从代码中完全删除,所以对代码的运行速度没有影响。断言的使用断言有两种方法:一种是 assert> ;另一种是 assert> :>。如果布尔表达式的值为false , 将抛出AssertionError 异常; 细节描...
分类:
编程语言 时间:
2015-05-07 00:24:33
阅读次数:
178
第二章 编程惯用法
建议8:利用assert语句来发现问题
断言在很多语言中都存在,它主要为调试程序服务,能够快速方便的检查程序的异常或者发现不恰当的输入等。
assert语法如下
assert expression1 [“,” expression]
其中计算expression1的值会返回True或者False,当值为False的时候会引发AssertionError,而ex...
分类:
编程语言 时间:
2015-05-05 16:36:23
阅读次数:
188
python有多少关键字?>>> import keyword>>> keyword.kwlist['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec',...
分类:
编程语言 时间:
2015-05-04 11:38:53
阅读次数:
158
一、题目简介设计一个简单的小游戏,五子棋游戏。二、源代码的Github链接https://github.com/guocui/guocui.github.com/tree/master三、测试截图测试类:import static org.junit.Assert.*;import org.juni...
分类:
其他好文 时间:
2015-05-03 20:33:58
阅读次数:
117
一 题目简介猜数字小游戏二 源码的github链接链接:https://github.com/gaoshuhua/master三 所设计的模块测试用例、测试结果截图import static org.junit.Assert.*;import org.junit.Test;public cl...
分类:
其他好文 时间:
2015-05-03 18:46:19
阅读次数:
134
我一直以为assert仅仅是个报错函数,事实上,它居然是个宏,并且作用并非“报错”。
在经过对其进行一定了解之后,对其作用及用法有了一定的了解,assert()的用法像是一种“契约式编程”,在我的理解中,其表达的意思就是,程序在我的假设条件下,能够正常良好的运作,其实就相当于一个if语句:
if(假设成立)
{
程序正常运行;
}
else
{
报...
分类:
其他好文 时间:
2015-05-02 16:37:05
阅读次数:
149
程序原型:之前的小学生四则运算程序编程语言:java测试代码如下: 1 package SuanFa; 2 3 import static org.junit.Assert.*; 4 5 import org.junit.Test; 6 7 public class CoreTest { 8 ...
分类:
其他好文 时间:
2015-04-30 17:41:28
阅读次数:
119
package com.h1;import static org.junit.Assert.*;import org.junit.Assert;import org.junit.Before;import org.junit.Test;import com.h2.Core;public class ...
分类:
其他好文 时间:
2015-04-30 17:33:09
阅读次数:
151