Sha256: b9ed216f9aaaa463e7c9fe3438b61685ddd1021d7bb371a17a43e1a1de18f910
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require File.expand_path("../../../test_helper", __FILE__) class COMAbstractEnumTest < Test::Unit::TestCase context "setting up the map" do setup do @enum = VirtualBox::COM::AbstractEnum @enum.reset! end should "set the map up and be able to access it" do @enum.map([:a, :b, :c]) assert_equal :a, @enum[0] assert_equal :b, @enum[1] assert_equal :c, @enum[2] assert_equal({:a => 0, :b => 1, :c => 2}, @enum.map) end should "do the reverse mapping of value to index" do @enum.map([:a, :b, :c]) assert_equal 1, @enum.index(:b) end should "reset the map if another is given" do @enum.map([:a]) @enum.map([:b]) assert_equal :b, @enum[0] end should "allow iterating over the enum" do array = [:a, :b, :c] other_array = [] @enum.map(array) @enum.each do |item| other_array << item end assert_equal array, other_array end should "include enumerable methods" do array = [:a, :b, :c] @enum.map(array) @enum.each_with_index do |object, index| assert_equal array[index], object end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
virtualbox-0.9.2 | test/virtualbox/com/abstract_enum_test.rb |
virtualbox-0.9.1 | test/virtualbox/com/abstract_enum_test.rb |
virtualbox-0.9.0 | test/virtualbox/com/abstract_enum_test.rb |