Sha256: 965bb80aa82f89f2a897744c390eae8a1f4242a08858450400654e758e7389f6

Contents?: true

Size: 505 Bytes

Versions: 6

Compression:

Stored size: 505 Bytes

Contents

require 'test/unit'
require 'iz'

class TestBinary < Test::Unit::TestCase

  def valid_binary_values
    ['0', '1', '1111', '0000000', '1010111100101']
  end

  def invalid_binary_values
    [nil, false, -1, '', '1112', 'g', '10101a']
  end

  def test_that_binary_values_return_true
    valid_binary_values.each do |hex|
      assert Iz.binary?(hex)
    end
  end

  def test_that_invalid_binary_values_return_false
    invalid_binary_values.each do |hex|
      assert !Iz.binary?(hex)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
iz-0.3.1 test/test_binary.rb
iz-0.3.0 test/test_binary.rb
iz-0.2.1 test/test_binary.rb
iz-0.2.0 test/test_binary.rb
iz-0.1.0 test/test_binary.rb
iz-0.0.1 test/test_binary.rb