Sha256: f377ae9d9f3e68989f1636f2da688d25c6362f05611195c5570b8f57087b9070

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

$: << File.join(File.dirname(__FILE__),"..","lib")

require "test/unit"
require "cim"

class QualifierSetTest < Test::Unit::TestCase
  def setup
    qbool    = CIM::QualifierDeclaration.new("flag")
    qint     = CIM::QualifierDeclaration.new("value", :uint32)
    qstring  = CIM::QualifierDeclaration.new("description", :string, "This is a description")
    @qualifiers = CIM::QualifierSet.new
    @qualifiers << CIM::Qualifier.new(qbool)
    @qualifiers << CIM::Qualifier.new(qint)
    @qualifiers << CIM::Qualifier.new(qstring)
  end
  def test_key
    assert_equal 3, @qualifiers.size
  end
  def test_prefill
    q = CIM::QualifierSet.new "a", :b
    assert 2, q.size
    assert q.include?( "a" )
    assert q.include?( "b", :bool )
  end
  def test_include
    assert @qualifiers.include?( :flag )
    assert @qualifiers.include?( "flag" )
    assert @qualifiers.include?( "flag", :bool )
    assert @qualifiers.include?( "flag", "bool" )
    assert !@qualifiers.include?( "flag", :string )
  end
  def test_access
    assert @qualifiers[:flag]
    assert @qualifiers["flag"]
    assert @qualifiers["flag", :bool]
    assert @qualifiers["flag", "bool"]
    assert !@qualifiers["flag", :string]
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cim-0.5.0 test/test_qualifier_set.rb