File: pass_thru_compressor_test.rb

package info (click to toggle)
ruby-zip 1.1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 668 kB
  • sloc: ruby: 7,041; makefile: 11
file content (31 lines) | stat: -rw-r--r-- 642 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'test_helper'

class PassThruCompressorTest < MiniTest::Unit::TestCase
  include CrcTest

  def test_size
    File.open("test/dummy.txt", "wb") {
        |file|
      compressor = ::Zip::PassThruCompressor.new(file)

      assert_equal(0, compressor.size)

      t1 = "hello world"
      t2 = ""
      t3 = "bingo"

      compressor << t1
      assert_equal(compressor.size, t1.size)

      compressor << t2
      assert_equal(compressor.size, t1.size + t2.size)

      compressor << t3
      assert_equal(compressor.size, t1.size + t2.size + t3.size)
    }
  end

  def test_crc
    run_crc_test(::Zip::PassThruCompressor)
  end
end