Sha256: bd3d310ac7d772841793aa5720846029d1c886fcc7535aefe8c2fd176a3bb0d2

Contents?: true

Size: 824 Bytes

Versions: 6

Compression:

Stored size: 824 Bytes

Contents

#!/usr/bin/env ruby
require 'test/unit'
require 'set'
require_relative '../../lib/trace_mod'

class TestEvent2Bitmask < Test::Unit::TestCase
  include Trace
  
  def test_basic
    test_pair = events2bitmask([LINE_EVENT_MASK, CLASS_EVENT_MASK])
    test_mask, unhandled = test_pair
    assert_equal(test_pair, 
                 events2bitmask(Set.new([LINE_EVENT_MASK, CLASS_EVENT_MASK])))
    assert_equal([:class, :line], bitmask2events(test_mask))

    EVENT2MASK.each do |mask_name, bit_value|
      assert_equal([mask_name], bitmask2events(bit_value))
    end

    assert_equal(test_pair, events2bitmask(['LINE', 'Class']))
    assert_equal(test_pair, events2bitmask(Set.new(['LINE', 'Class'])))
    [[:foo, 'bar'], ['C call', ['bar']]].each do |bad|
      assert_equal([0, bad], events2bitmask(bad))
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rb-trace-0.7 test/unit/test-event2bitmask.rb
rb-trace-0.6 test/unit/test-event2bitmask.rb
rb-trace-0.5 test/unit/test-event2bitmask.rb
rb-trace-0.4 test/unit/test-event2bitmask.rb
rb-trace-0.3 test/unit/test-event2bitmask.rb
rb-trace-0.2 test/unit/test-event2bitmask.rb