Sha256: bc94e9f39f754d741b8f8295256776480b98e32a177f4b485199013cfd2b8492

Contents?: true

Size: 934 Bytes

Versions: 1

Compression:

Stored size: 934 Bytes

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/more/bitmask.rb
#
# Extracted Mon Jul 03 00:56:56 EDT 2006
# Unit Tools Reap Test Extractor
#

require 'facets/more/bitmask.rb'


  require 'test/unit'

  class TC_Integer < Test::Unit::TestCase

    def test_001
      assert_equal( 1, 0.set_bit(0) )
      assert_equal( 2, 0.set_bit(1) )
      assert_equal( 4, 0.set_bit(2) )
      assert_equal( 8, 0.set_bit(3) )
    end

    def test_002
      assert_equal( 0, 1.clear_bit(0) )
      assert_equal( 0, 2.clear_bit(1) )
      assert_equal( 0, 4.clear_bit(2) )
      assert_equal( 0, 8.clear_bit(3) )
    end

    def test_003
      a =  1
      m = bitmask(4)
      a = a.set_bitmask(m)
      assert_equal( 17, a )
      assert( a.test_bitmask(m) )
      assert( a.test_bit(4) )
      assert( a.bit_set?(4) )
      assert( ! a.test_bit(12) )
    end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.4.4 test/lib/facets/more/test_bitmask.rb