pr-zlib 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +1 -0
- data.tar.gz.sig +1 -0
- data/CHANGES +23 -13
- data/MANIFEST +20 -18
- data/README +52 -42
- data/Rakefile +116 -119
- data/bin/minizip.rb +173 -173
- data/certs/djberg96_pub.pem +21 -0
- data/examples/example_rbzlib.rb +385 -385
- data/lib/pr-zlib.rb +1 -0
- data/lib/pr/rbzlib.rb +5079 -5060
- data/lib/pr/zlib.rb +1567 -1554
- data/pr-zlib.gemspec +24 -22
- data/profile/bench_pr_zlib.rb +43 -43
- data/profile/bench_zlib.rb +43 -43
- data/profile/profile_pr_zlib_read.rb +28 -28
- data/profile/profile_pr_zlib_write.rb +26 -26
- data/test/test_zlib.rb +168 -160
- data/test/test_zlib_gzip_reader.rb +183 -183
- data/test/test_zlib_gzip_writer.rb +186 -184
- data/test/test_zlib_zstream.rb +146 -146
- metadata +41 -9
- metadata.gz.sig +0 -0
@@ -1,183 +1,183 @@
|
|
1
|
-
########################################################################
|
2
|
-
# test_zlib_gzip_reader.rb
|
3
|
-
#
|
4
|
-
# Tests for the GzipReader class.
|
5
|
-
########################################################################
|
6
|
-
require 'test-unit'
|
7
|
-
require 'fileutils'
|
8
|
-
require 'pr/zlib'
|
9
|
-
|
10
|
-
class TC_GzipReader < Test::Unit::TestCase
|
11
|
-
def self.startup
|
12
|
-
Dir.chdir('test') if File.basename(Dir.pwd) != 'test'
|
13
|
-
File.open('test.txt', 'wb'){ |fh| fh.puts 'Test file' }
|
14
|
-
system('gzip *.txt')
|
15
|
-
@@gz_file = 'test.txt.gz'
|
16
|
-
end
|
17
|
-
|
18
|
-
def setup
|
19
|
-
@handle = File.open(@@gz_file)
|
20
|
-
@gz_reader = Zlib::GzipReader.new(@handle)
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_constructor_expected_errors
|
24
|
-
assert_raise(ArgumentError){ Zlib::GzipReader.new }
|
25
|
-
assert_raise(NoMethodError){ Zlib::GzipReader.new(1) }
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_lineno_get_basic
|
29
|
-
assert_respond_to(@gz_reader, :lineno)
|
30
|
-
assert_nothing_raised{ @gz_reader.lineno }
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_lineno_get
|
34
|
-
assert_kind_of(Fixnum, @gz_reader.lineno)
|
35
|
-
assert_equal(0, @gz_reader.lineno)
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_lineno_set_basic
|
39
|
-
assert_respond_to(@gz_reader, :lineno=)
|
40
|
-
assert_nothing_raised{ @gz_reader.lineno = 0 }
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_lineno_set
|
44
|
-
assert_kind_of(Fixnum, @gz_reader.lineno = 0)
|
45
|
-
assert_equal(0, @gz_reader.lineno = 0)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_eof_basic
|
49
|
-
assert_respond_to(@gz_reader, :eof)
|
50
|
-
assert_nothing_raised{ @gz_reader.eof }
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_pos_basic
|
54
|
-
assert_respond_to(@gz_reader, :pos)
|
55
|
-
assert_nothing_raised{ @gz_reader.pos }
|
56
|
-
end
|
57
|
-
|
58
|
-
def test_pos
|
59
|
-
assert_kind_of(Fixnum, @gz_reader.pos)
|
60
|
-
end
|
61
|
-
|
62
|
-
def test_rewind_basic
|
63
|
-
assert_respond_to(@gz_reader, :rewind)
|
64
|
-
assert_nothing_raised{ @gz_reader.rewind }
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_rewind
|
68
|
-
assert_equal(0, @gz_reader.rewind)
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_unused_basic
|
72
|
-
assert_respond_to(@gz_reader, :unused)
|
73
|
-
assert_nothing_raised{ @gz_reader.unused }
|
74
|
-
end
|
75
|
-
|
76
|
-
def test_unused
|
77
|
-
assert_nil(@gz_reader.unused)
|
78
|
-
end
|
79
|
-
|
80
|
-
def test_read_basic
|
81
|
-
assert_respond_to(@gz_reader, :read)
|
82
|
-
assert_nothing_raised{ @gz_reader.read }
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_read
|
86
|
-
assert_equal("Test file\n", @gz_reader.read)
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_read_with_length
|
90
|
-
assert_equal("Test", @gz_reader.read(4))
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_read_expected_errors
|
94
|
-
assert_raise(ArgumentError){ @gz_reader.read(-1) }
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_getc_basic
|
98
|
-
assert_respond_to(@gz_reader, :getc)
|
99
|
-
assert_nothing_raised{ @gz_reader.getc }
|
100
|
-
end
|
101
|
-
|
102
|
-
def test_getc
|
103
|
-
expected = RUBY_VERSION.to_f >= 1.9 ? 'T' : 84
|
104
|
-
assert_equal(expected, @gz_reader.getc)
|
105
|
-
end
|
106
|
-
|
107
|
-
def test_readchar_basic
|
108
|
-
assert_respond_to(@gz_reader, :readchar)
|
109
|
-
assert_nothing_raised{ @gz_reader.readchar }
|
110
|
-
end
|
111
|
-
|
112
|
-
def test_readchar
|
113
|
-
expected = RUBY_VERSION.to_f >= 1.9 ? 'T' : 84
|
114
|
-
assert_equal(expected, @gz_reader.readchar)
|
115
|
-
end
|
116
|
-
|
117
|
-
def test_each_byte_basic
|
118
|
-
assert_respond_to(@gz_reader, :each_byte)
|
119
|
-
assert_nothing_raised{ @gz_reader.each_byte{} }
|
120
|
-
end
|
121
|
-
|
122
|
-
def test_each_byte
|
123
|
-
assert_nil(@gz_reader.each_byte{})
|
124
|
-
end
|
125
|
-
|
126
|
-
def test_ungetc_basic
|
127
|
-
assert_respond_to(@gz_reader, :ungetc)
|
128
|
-
assert_nothing_raised{ @gz_reader.ungetc(99) }
|
129
|
-
end
|
130
|
-
|
131
|
-
def test_ungetc
|
132
|
-
assert_nil(@gz_reader.ungetc(99))
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_gets_basic
|
136
|
-
assert_respond_to(@gz_reader, :gets)
|
137
|
-
assert_nothing_raised{ @gz_reader.gets }
|
138
|
-
end
|
139
|
-
|
140
|
-
def test_gets
|
141
|
-
assert_equal("Test file\n", @gz_reader.gets)
|
142
|
-
omit('Skipping $_ test')
|
143
|
-
assert_equal("Test file\n", $_)
|
144
|
-
end
|
145
|
-
|
146
|
-
def test_readline_basic
|
147
|
-
assert_respond_to(@gz_reader, :readline)
|
148
|
-
assert_nothing_raised{ @gz_reader.readline }
|
149
|
-
end
|
150
|
-
|
151
|
-
def test_readline
|
152
|
-
assert_equal("Test file\n", @gz_reader.readline)
|
153
|
-
end
|
154
|
-
|
155
|
-
def test_each_basic
|
156
|
-
assert_respond_to(@gz_reader, :each)
|
157
|
-
assert_nothing_raised{ @gz_reader.each{} }
|
158
|
-
end
|
159
|
-
|
160
|
-
def test_each
|
161
|
-
assert_not_nil(@gz_reader.each{})
|
162
|
-
end
|
163
|
-
|
164
|
-
def test_readlines_basic
|
165
|
-
assert_respond_to(@gz_reader, :readlines)
|
166
|
-
assert_nothing_raised{ @gz_reader.readlines }
|
167
|
-
end
|
168
|
-
|
169
|
-
def test_readlines
|
170
|
-
assert_equal(["Test file\n"], @gz_reader.readlines)
|
171
|
-
end
|
172
|
-
|
173
|
-
def teardown
|
174
|
-
@handle.close if @handle && !@handle.closed?
|
175
|
-
@handle = nil
|
176
|
-
@gz_reader = nil
|
177
|
-
end
|
178
|
-
|
179
|
-
def self.shutdown
|
180
|
-
File.delete(@@gz_file) if File.exist?(@@gz_file)
|
181
|
-
@@gz_file = nil
|
182
|
-
end
|
183
|
-
end
|
1
|
+
########################################################################
|
2
|
+
# test_zlib_gzip_reader.rb
|
3
|
+
#
|
4
|
+
# Tests for the GzipReader class.
|
5
|
+
########################################################################
|
6
|
+
require 'test-unit'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'pr/zlib'
|
9
|
+
|
10
|
+
class TC_GzipReader < Test::Unit::TestCase
|
11
|
+
def self.startup
|
12
|
+
Dir.chdir('test') if File.basename(Dir.pwd) != 'test'
|
13
|
+
File.open('test.txt', 'wb'){ |fh| fh.puts 'Test file' }
|
14
|
+
system('gzip *.txt')
|
15
|
+
@@gz_file = 'test.txt.gz'
|
16
|
+
end
|
17
|
+
|
18
|
+
def setup
|
19
|
+
@handle = File.open(@@gz_file)
|
20
|
+
@gz_reader = Zlib::GzipReader.new(@handle)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_constructor_expected_errors
|
24
|
+
assert_raise(ArgumentError){ Zlib::GzipReader.new }
|
25
|
+
assert_raise(NoMethodError){ Zlib::GzipReader.new(1) }
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_lineno_get_basic
|
29
|
+
assert_respond_to(@gz_reader, :lineno)
|
30
|
+
assert_nothing_raised{ @gz_reader.lineno }
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_lineno_get
|
34
|
+
assert_kind_of(Fixnum, @gz_reader.lineno)
|
35
|
+
assert_equal(0, @gz_reader.lineno)
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_lineno_set_basic
|
39
|
+
assert_respond_to(@gz_reader, :lineno=)
|
40
|
+
assert_nothing_raised{ @gz_reader.lineno = 0 }
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_lineno_set
|
44
|
+
assert_kind_of(Fixnum, @gz_reader.lineno = 0)
|
45
|
+
assert_equal(0, @gz_reader.lineno = 0)
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_eof_basic
|
49
|
+
assert_respond_to(@gz_reader, :eof)
|
50
|
+
assert_nothing_raised{ @gz_reader.eof }
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_pos_basic
|
54
|
+
assert_respond_to(@gz_reader, :pos)
|
55
|
+
assert_nothing_raised{ @gz_reader.pos }
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_pos
|
59
|
+
assert_kind_of(Fixnum, @gz_reader.pos)
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_rewind_basic
|
63
|
+
assert_respond_to(@gz_reader, :rewind)
|
64
|
+
assert_nothing_raised{ @gz_reader.rewind }
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_rewind
|
68
|
+
assert_equal(0, @gz_reader.rewind)
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_unused_basic
|
72
|
+
assert_respond_to(@gz_reader, :unused)
|
73
|
+
assert_nothing_raised{ @gz_reader.unused }
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_unused
|
77
|
+
assert_nil(@gz_reader.unused)
|
78
|
+
end
|
79
|
+
|
80
|
+
def test_read_basic
|
81
|
+
assert_respond_to(@gz_reader, :read)
|
82
|
+
assert_nothing_raised{ @gz_reader.read }
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_read
|
86
|
+
assert_equal("Test file\n", @gz_reader.read)
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_read_with_length
|
90
|
+
assert_equal("Test", @gz_reader.read(4))
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_read_expected_errors
|
94
|
+
assert_raise(ArgumentError){ @gz_reader.read(-1) }
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_getc_basic
|
98
|
+
assert_respond_to(@gz_reader, :getc)
|
99
|
+
assert_nothing_raised{ @gz_reader.getc }
|
100
|
+
end
|
101
|
+
|
102
|
+
def test_getc
|
103
|
+
expected = RUBY_VERSION.to_f >= 1.9 ? 'T' : 84
|
104
|
+
assert_equal(expected, @gz_reader.getc)
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_readchar_basic
|
108
|
+
assert_respond_to(@gz_reader, :readchar)
|
109
|
+
assert_nothing_raised{ @gz_reader.readchar }
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_readchar
|
113
|
+
expected = RUBY_VERSION.to_f >= 1.9 ? 'T' : 84
|
114
|
+
assert_equal(expected, @gz_reader.readchar)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_each_byte_basic
|
118
|
+
assert_respond_to(@gz_reader, :each_byte)
|
119
|
+
assert_nothing_raised{ @gz_reader.each_byte{} }
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_each_byte
|
123
|
+
assert_nil(@gz_reader.each_byte{})
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_ungetc_basic
|
127
|
+
assert_respond_to(@gz_reader, :ungetc)
|
128
|
+
assert_nothing_raised{ @gz_reader.ungetc(99) }
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_ungetc
|
132
|
+
assert_nil(@gz_reader.ungetc(99))
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_gets_basic
|
136
|
+
assert_respond_to(@gz_reader, :gets)
|
137
|
+
assert_nothing_raised{ @gz_reader.gets }
|
138
|
+
end
|
139
|
+
|
140
|
+
def test_gets
|
141
|
+
assert_equal("Test file\n", @gz_reader.gets)
|
142
|
+
omit('Skipping $_ test')
|
143
|
+
assert_equal("Test file\n", $_)
|
144
|
+
end
|
145
|
+
|
146
|
+
def test_readline_basic
|
147
|
+
assert_respond_to(@gz_reader, :readline)
|
148
|
+
assert_nothing_raised{ @gz_reader.readline }
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_readline
|
152
|
+
assert_equal("Test file\n", @gz_reader.readline)
|
153
|
+
end
|
154
|
+
|
155
|
+
def test_each_basic
|
156
|
+
assert_respond_to(@gz_reader, :each)
|
157
|
+
assert_nothing_raised{ @gz_reader.each{} }
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_each
|
161
|
+
assert_not_nil(@gz_reader.each{})
|
162
|
+
end
|
163
|
+
|
164
|
+
def test_readlines_basic
|
165
|
+
assert_respond_to(@gz_reader, :readlines)
|
166
|
+
assert_nothing_raised{ @gz_reader.readlines }
|
167
|
+
end
|
168
|
+
|
169
|
+
def test_readlines
|
170
|
+
assert_equal(["Test file\n"], @gz_reader.readlines)
|
171
|
+
end
|
172
|
+
|
173
|
+
def teardown
|
174
|
+
@handle.close if @handle && !@handle.closed?
|
175
|
+
@handle = nil
|
176
|
+
@gz_reader = nil
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.shutdown
|
180
|
+
File.delete(@@gz_file) if File.exist?(@@gz_file)
|
181
|
+
@@gz_file = nil
|
182
|
+
end
|
183
|
+
end
|
@@ -1,184 +1,186 @@
|
|
1
|
-
########################################################################
|
2
|
-
# test_zlib_gzip_writer.rb
|
3
|
-
#
|
4
|
-
# Test case for the Zlib::GzipWriter class.
|
5
|
-
########################################################################
|
6
|
-
require 'pr/zlib'
|
7
|
-
require 'test-unit'
|
8
|
-
|
9
|
-
class TC_Zlib_GzipWriter < Test::Unit::TestCase
|
10
|
-
def self.startup
|
11
|
-
@@file = 'gzip_writer_test.gz'
|
12
|
-
end
|
13
|
-
|
14
|
-
def setup
|
15
|
-
@handle = File.new(@@file, 'w')
|
16
|
-
@writer = Zlib::GzipWriter.new(@handle)
|
17
|
-
@time = Time.now
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_constructor
|
21
|
-
assert_nothing_raised{ @writer = Zlib::GzipWriter.new(@handle) }
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
assert_equal(
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
@
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
1
|
+
########################################################################
|
2
|
+
# test_zlib_gzip_writer.rb
|
3
|
+
#
|
4
|
+
# Test case for the Zlib::GzipWriter class.
|
5
|
+
########################################################################
|
6
|
+
require 'pr/zlib'
|
7
|
+
require 'test-unit'
|
8
|
+
|
9
|
+
class TC_Zlib_GzipWriter < Test::Unit::TestCase
|
10
|
+
def self.startup
|
11
|
+
@@file = 'gzip_writer_test.gz'
|
12
|
+
end
|
13
|
+
|
14
|
+
def setup
|
15
|
+
@handle = File.new(@@file, 'w')
|
16
|
+
@writer = Zlib::GzipWriter.new(@handle)
|
17
|
+
@time = Time.now
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_constructor
|
21
|
+
assert_nothing_raised{ @writer = Zlib::GzipWriter.new(@handle) }
|
22
|
+
assert_nothing_raised{ @writer = Zlib::GzipWriter.new(@handle, nil) }
|
23
|
+
assert_nothing_raised{ @writer = Zlib::GzipWriter.new(@handle, nil, nil) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_constructor_expected_errors
|
27
|
+
assert_raise(ArgumentError){ Zlib::GzipWriter.new }
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_level
|
31
|
+
assert_respond_to(@writer, :level)
|
32
|
+
assert_equal(Z_DEFAULT_COMPRESSION, @writer.level)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_mtime_get_basic
|
36
|
+
assert_respond_to(@writer, :mtime)
|
37
|
+
assert_nothing_raised{ @writer.mtime }
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_mtime_get
|
41
|
+
assert_kind_of(Time, @writer.mtime)
|
42
|
+
assert_equal(Time.at(0), @writer.mtime)
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_mtime_set_basic
|
46
|
+
assert_respond_to(@writer, :mtime=)
|
47
|
+
assert_nothing_raised{ @writer.mtime = @time }
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_mtime_set
|
51
|
+
assert_equal(@time, @writer.mtime = @time)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_orig_name_get_basic
|
55
|
+
assert_respond_to(@writer, :orig_name)
|
56
|
+
assert_nothing_raised{ @writer.orig_name }
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_orig_name_get
|
60
|
+
assert_nil(@writer.orig_name)
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_orig_name_set_basic
|
64
|
+
assert_respond_to(@writer, :orig_name=)
|
65
|
+
assert_nothing_raised{ @writer.orig_name = 'test' }
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_orig_name_set
|
69
|
+
assert_equal('test', @writer.orig_name = 'test')
|
70
|
+
assert_equal('test', @writer.orig_name)
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_comment_get_basic
|
74
|
+
assert_respond_to(@writer, :comment)
|
75
|
+
assert_nothing_raised{ @writer.comment }
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_comment_get
|
79
|
+
assert_nil(@writer.comment)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_comment_set_basic
|
83
|
+
assert_respond_to(@writer, :comment=)
|
84
|
+
assert_nothing_raised{ @writer.comment = 'test' }
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_comment_set
|
88
|
+
assert_equal('test', @writer.comment = 'test')
|
89
|
+
assert_equal('test', @writer.comment)
|
90
|
+
end
|
91
|
+
|
92
|
+
def test_pos_basic
|
93
|
+
assert_respond_to(@writer, :pos)
|
94
|
+
assert_nothing_raised{ @writer.pos }
|
95
|
+
assert_kind_of(Fixnum, @writer.pos)
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_pos
|
99
|
+
assert_equal(0, @writer.pos)
|
100
|
+
assert_nothing_raised{ @writer.write('test') }
|
101
|
+
assert_equal(4, @writer.pos)
|
102
|
+
end
|
103
|
+
|
104
|
+
def test_tell_alias
|
105
|
+
assert_alias_method(@writer, :pos, :tell)
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_open_basic
|
109
|
+
assert_respond_to(Zlib::GzipWriter, :open)
|
110
|
+
assert_nothing_raised{ Zlib::GzipWriter.open(@@file){} }
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_flush_basic
|
114
|
+
assert_respond_to(@writer, :flush)
|
115
|
+
assert_nothing_raised{ @writer.flush }
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_flush
|
119
|
+
assert_equal(@writer, @writer.flush)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_write_basic
|
123
|
+
assert_respond_to(@writer, :write)
|
124
|
+
assert_nothing_raised{ @writer.write('test') }
|
125
|
+
end
|
126
|
+
|
127
|
+
def test_write
|
128
|
+
assert_equal(4, @writer.write('test'))
|
129
|
+
assert_equal(3, @writer.write(999))
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_write_expected_errors
|
133
|
+
assert_raise(ArgumentError){ @writer.write }
|
134
|
+
end
|
135
|
+
|
136
|
+
def test_putc_basic
|
137
|
+
assert_respond_to(@writer, :putc)
|
138
|
+
assert_nothing_raised{ @writer.putc(97) }
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_putc
|
142
|
+
assert_equal(97, @writer.putc(97))
|
143
|
+
end
|
144
|
+
|
145
|
+
def test_putc_expected_errors
|
146
|
+
assert_raise(ArgumentError){ @writer.putc }
|
147
|
+
end
|
148
|
+
|
149
|
+
def test_append_basic
|
150
|
+
assert_respond_to(@writer, :<<)
|
151
|
+
assert_nothing_raised{ @writer << 'test' }
|
152
|
+
end
|
153
|
+
|
154
|
+
def test_append_expected_errors
|
155
|
+
assert_raise(ArgumentError){ @writer.send(:<<) }
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_printf_basic
|
159
|
+
assert_respond_to(@writer, :printf)
|
160
|
+
assert_nothing_raised{ @writer.printf('%s', 'test') }
|
161
|
+
end
|
162
|
+
|
163
|
+
def test_printf_expected_errors
|
164
|
+
assert_raise(ArgumentError){ @writer.printf }
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_puts_basic
|
168
|
+
assert_respond_to(@writer, :puts)
|
169
|
+
assert_nothing_raised{ @writer.puts('test') }
|
170
|
+
end
|
171
|
+
|
172
|
+
def test_puts_expected_errors
|
173
|
+
assert_raise(ArgumentError){ @writer.puts }
|
174
|
+
assert_raise(ArgumentError){ @writer.puts('test1', 'test2') }
|
175
|
+
end
|
176
|
+
|
177
|
+
def teardown
|
178
|
+
@handle.close if @handle && !@handle.closed?
|
179
|
+
@handle = nil
|
180
|
+
@time = nil
|
181
|
+
end
|
182
|
+
|
183
|
+
def self.shutdown
|
184
|
+
File.delete(@@file) if File.exist?(@@file)
|
185
|
+
end
|
186
|
+
end
|