#!/usr/bin/ruby
# encoding: UTF-8

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')

require 'daniel'

describe Daniel::Util do
  it "converts hex to binary as expected" do
    expected = "\x00A7\x80".force_encoding("BINARY")
    expect(Daniel::Util.from_hex("00413780")).to eq expected
  end
  it "converts hex to binary as expected" do
    expect(Daniel::Util.to_hex("\x00A7\x80")).to eq "00413780"
  end
end

#!/usr/bin/ruby
# encoding: UTF-8

$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')

require 'daniel'

describe Daniel::Util do
  it "converts hex to binary as expected" do
    expected = "\x00A7\x80"
    if ::RUBY_VERSION.to_f > 1.8
      expected = expected.force_encoding("BINARY")
    end
    expect(Daniel::Util.from_hex("00413780")).to eq expected
  end
  it "converts hex to binary as expected" do
    expect(Daniel::Util.to_hex("\x00A7\x80")).to eq "00413780"
  end
end

Fix additional Ruby 1.8 incompatibility.
Fix additional Ruby 1.8 incompatibility.

Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
