Assertions#assert_in_delta
require "test/unit"
include Test::Unit::Assertions
begin
assert_in_delta -39.30 * 100, -3930, 1e-12 #in 1e-12
rescue
print "not in 1e-12", "/n"
else
print "in 1e-12", "/n"
end
begin
assert_in_delta -39.30 * 100, -3930, 1e-13 #not in 1e-12
rescue
print "not in 1e-13", "/n"
else
print "in 1e-13", "/n"
end
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
