【发布时间】:2013-12-15 05:20:56
【问题描述】:
我想知道我的代码的测试用例是什么。 在下面提供我的代码... 如何在 jasmine 中编写测试用例 代码完全在js中...
function lowestEpsilon(of) {
return of.reduce(minimal, [Infinity, Infinity]).shift()
// pass around a pair of [value, Math.abs(value)] and replace
// it if the current item has a better absolute value.
function minimal(previously, value) {
var absolute = Math.abs(value)
if ( absolute < previously[1] )
return [value, absolute]
return previously
}
}
lowestEpsilon([1,2,-0.5])
lowestEpsilon([50,0.3,-0.2,1,50])
【问题讨论】:
-
嗨,您可以编辑以澄清您的问题吗? (看起来底部已经有两个测试用例了。)
-
@KevinChen: jasmine 测试用例我需要写..谢谢你的回复..
标签: javascript unit-testing testing automated-tests jasmine