Sha256: a00059dc45a50fe39cfd133b7a293e4bf83c2c86d15091127ddc0f0a02485465

Contents?: true

Size: 1021 Bytes

Versions: 90

Compression:

Stored size: 1021 Bytes

Contents

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

require_relative 'common'
require 'hexapdf/filter/run_length_decode'

describe HexaPDF::Filter::RunLengthDecode do
  include CommonFilterTests

  before do
    @obj = HexaPDF::Filter::RunLengthDecode
    @all_test_cases ||= [['abcabcaaaabbbcdeffffffagggggg'.b,
                          "\x05abcabc\xFDa\xFEb\x02cde\xFBf\x00a\xFBg\x80".b]]
    @decoded = @all_test_cases[0][0]
    @encoded = @all_test_cases[0][1]
  end

  describe "decoder" do
    it "fails if data is missing from the source stream" do
      assert_raises(HexaPDF::FilterError) { collector(@obj.decoder(feeder(@encoded.chop.chop))) }
    end
  end

  # Won't work because the encoding is dependent on the length of the data that is passed in
  undef_method :test_encoder_works_with_single_byte_input

  describe "encoder" do
    it "works with single byte input" do
      assert_equal(@encoded.chars.map {|a| "\0#{a}" }.join << "\x80".b,
                   collector(@obj.encoder(feeder(@encoded.dup, 1))))
    end
  end
end

Version data entries

90 entries across 90 versions & 1 rubygems

Version Path
hexapdf-1.0.2 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-1.0.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-1.0.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.47.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.46.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.45.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.44.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.41.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.40.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.39.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.39.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.38.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.37.2 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.37.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.37.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.36.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.35.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.35.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.34.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.34.0 test/hexapdf/filter/test_run_length_decode.rb