Clean up deflater_test.rb generated files.

Now force file generation into the test/data/generated directory where other
such files go so tests are cleaned up properly.
This commit is contained in:
Robert Haines 2014-07-15 16:54:49 +01:00 committed by Alexander Simonov
parent 2b6044530f
commit 656116c55a
2 changed files with 13 additions and 10 deletions

2
.gitignore vendored
View File

@ -5,8 +5,6 @@ test/cdirtest.bin
test/cdir64test.bin
test/huge.zip
test/data/generated/
test/deflatertest.bin
test/compressiontest_*.bin
test/dummy.txt
test/okToDeleteMoved.txt
test/output.zip

View File

@ -3,10 +3,15 @@ require 'test_helper'
class DeflaterTest < MiniTest::Test
include CrcTest
DEFLATER_TEST_FILE = 'test/data/generated/deflatertest.bin'
BEST_COMP_FILE = 'test/data/generated/compressiontest_best_compression.bin'
DEFAULT_COMP_FILE = 'test/data/generated/compressiontest_default_compression.bin'
NO_COMP_FILE = 'test/data/generated/compressiontest_no_compression.bin'
def test_outputOperator
txt = load_file("test/data/file2.txt")
deflate(txt, "deflatertest.bin")
inflatedTxt = inflate("deflatertest.bin")
deflate(txt, DEFLATER_TEST_FILE)
inflatedTxt = inflate(DEFLATER_TEST_FILE)
assert_equal(txt, inflatedTxt)
end
@ -14,15 +19,15 @@ class DeflaterTest < MiniTest::Test
txt = load_file("test/data/file2.txt")
Zip.default_compression = ::Zlib::BEST_COMPRESSION
deflate(txt, "compressiontest_best_compression.bin")
deflate(txt, BEST_COMP_FILE)
Zip.default_compression = ::Zlib::DEFAULT_COMPRESSION
deflate(txt, "compressiontest_default_compression.bin")
deflate(txt, DEFAULT_COMP_FILE)
Zip.default_compression = ::Zlib::NO_COMPRESSION
deflate(txt, "compressiontest_no_compression.bin")
deflate(txt, NO_COMP_FILE)
best = File.size("compressiontest_best_compression.bin")
default = File.size("compressiontest_default_compression.bin")
no = File.size("compressiontest_no_compression.bin")
best = File.size(BEST_COMP_FILE)
default = File.size(DEFAULT_COMP_FILE)
no = File.size(NO_COMP_FILE)
assert(best < default)
assert(best < no)