Sha256: 67533793c0ff52aa0aca817f64ddce11526b4ff2b0b8f2c75b0863f452ffc2fa

Contents?: true

Size: 996 Bytes

Versions: 6

Compression:

Stored size: 996 Bytes

Contents

# -*- encoding: utf-8 -*-

require_relative 'common'
require 'hexapdf/filter/ascii_hex_decode'

describe HexaPDF::Filter::ASCIIHexDecode do
  include CommonFilterTests

  before do
    @obj = HexaPDF::Filter::ASCIIHexDecode
    @all_test_cases = [['Nov shmoz ka pop.', '4e6f762073686d6f7a206b6120706f702e>']]
    @decoded = @all_test_cases[0][0]
    @encoded = @all_test_cases[0][1]
  end

  describe "decoder" do
    it "ignores whitespace in the input" do
      assert_equal(@decoded, collector(@obj.decoder(feeder(@encoded.scan(/./).map {|a| "#{a} \r\t"}.join("\n"), 1))))
    end

    it "works without the EOD marker" do
      assert_equal(@decoded, collector(@obj.decoder(feeder(@encoded.chop, 5))))
    end

    it "ignores data after the EOD marker" do
      assert_equal(@decoded, collector(@obj.decoder(feeder(@encoded + '4e6f7gzz'))))
    end

    it "fails on invalid characters" do
      assert_raises(HexaPDF::FilterError) { @obj.decoder(feeder('f0f0z')).resume }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hexapdf-0.6.0 test/hexapdf/filter/test_ascii_hex_decode.rb
hexapdf-0.5.0 test/hexapdf/filter/test_ascii_hex_decode.rb
hexapdf-0.4.0 test/hexapdf/filter/test_ascii_hex_decode.rb
hexapdf-0.3.0 test/hexapdf/filter/test_ascii_hex_decode.rb
hexapdf-0.2.0 test/hexapdf/filter/test_ascii_hex_decode.rb
hexapdf-0.1.0 test/hexapdf/filter/test_ascii_hex_decode.rb