Sha256: ece2af4bc655f2cf4b78f06cc867cd378ed57bf2c9cc2f9dfc6cbc39390c962b

Contents?: true

Size: 517 Bytes

Versions: 6

Compression:

Stored size: 517 Bytes

Contents

require 'test/unit'
require 'iz'

class TestHexadecimal < Test::Unit::TestCase

  def valid_hexadecimals
    ['123', '1bc', 'AB99', '8098098AbCdEf']
  end

  def invalid_hexadecimals
    [nil, false, -1, '', '    ', 'g', '123g']
  end

  def test_that_hexadecimal_values_return_true
    valid_hexadecimals.each do |hex|
      assert Iz.hexadecimal?(hex)
    end
  end

  def test_that_invalid_hexadecimal_values_return_false
    invalid_hexadecimals.each do |hex|
      assert !Iz.hexadecimal?(hex)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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