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-0.15.2 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.15.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.15.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.14.4 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.14.3 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.14.2 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.14.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.14.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.13.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.12.3 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.12.2 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.12.1 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.12.0 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.9 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.8 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.7 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.6 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.5 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.4 test/hexapdf/filter/test_run_length_decode.rb
hexapdf-0.11.3 test/hexapdf/filter/test_run_length_decode.rb