Archive for June, 2008
Ruby, Testing
In Ruby -> Test::unit::TestCase is easy
require ‘test/unit’
the name of the class to be tested is Roman then the testing class will TestRoman < Test::Unit::TestCase
and a simple method
def test_simple
assert_equal (“expected_result”, call_to the method of class to be checked –>actual result)
end
for testing a particular method….
ruby test_roman.rb –name “name of the method”
location of the test file should
$:.unshift File.join(File.dirname(__FILE__),”..”,”lib”)
require….the [...]
Ruby – Numeric
Numeric
Integer Float
FixNum BigNum Rational ComplexNum
nan?
zero?/nonzero?
finite?/infinite?,integer?
ceil,floor,round,
divmod,quo,remainder
next,succ,step(10,2),times,chr,