From 656116c55a98f8a53ef8590ca23c1c84c614f291 Mon Sep 17 00:00:00 2001 From: Robert Haines Date: Tue, 15 Jul 2014 16:54:49 +0100 Subject: [PATCH] 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. --- .gitignore | 2 -- test/deflater_test.rb | 21 +++++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index dac1185..87e357d 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/test/deflater_test.rb b/test/deflater_test.rb index 666e7e3..38a87c4 100644 --- a/test/deflater_test.rb +++ b/test/deflater_test.rb @@ -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)