1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
require 'helper'
class TypesTest < Test::Unit::TestCase
def test_gv_bool
bool = nil
assert_block "Create true GvBool failed." do
bool = GraphViz::Types::GvBool.new(true)
end
assert bool
assert_equal true, bool.to_ruby
assert_block "Create \"true\" GvBool failed." do
bool = GraphViz::Types::GvBool.new("true")
end
assert bool
assert_equal true, bool.to_ruby
assert_block "Create \"Yes\" GvBool failed." do
bool = GraphViz::Types::GvBool.new("Yes")
end
assert bool
assert_equal true, bool.to_ruby
assert_block "Create 1 GvBool failed." do
bool = GraphViz::Types::GvBool.new(1)
end
assert bool
assert_equal true, bool.to_ruby
assert_block "Create false GvBool failed." do
bool = GraphViz::Types::GvBool.new(false)
end
assert bool
assert_equal false, bool.to_ruby
assert_block "Create \"false\" GvBool failed." do
bool = GraphViz::Types::GvBool.new("false")
end
assert bool
assert_equal false, bool.to_ruby
assert_block "Create \"NO\" GvBool failed." do
bool = GraphViz::Types::GvBool.new("NO")
end
assert bool
assert_equal false, bool.to_ruby
assert_block "Create 0 GvBool failed." do
bool = GraphViz::Types::GvBool.new(0)
end
assert bool
assert_equal false, bool.to_ruby
assert_raise BoolException, "Wrong bool value" do
GraphViz::Types::GvBool.new(:toto)
end
assert_block "Create GvBool with empty string failed." do
bool = GraphViz::Types::GvBool.new("")
end
assert bool
assert_equal false, bool.to_ruby
end
end
|