Sha256: 05af1161739f1440ad3426d8e975f061c26a61494888313220db6907d8b5ad6b

Contents?: true

Size: 1.61 KB

Versions: 9

Compression:

Stored size: 1.61 KB

Contents

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

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
ruby-graphviz-1.2.5 test/test_types.rb
ruby-graphviz-1.2.4 test/test_types.rb
ruby-graphviz-1.2.3 test/test_types.rb
ruby-graphviz-1.2.2 test/test_types.rb
ruby-graphviz-1.2.1 test/test_types.rb
ruby-graphviz-1.2.0 test/test_types.rb
ruby-graphviz-1.1.0 test/test_types.rb
ruby-graphviz_c-1.1.1 test/test_types.rb
ruby-graphviz_c-1.1.0 test/test_types.rb