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.
@@ -1,146 +1,146 @@
1
- require 'test-unit'
2
- require 'pr/zlib'
3
-
4
- class TC_Zlib_Zstream < Test::Unit::TestCase
5
- def self.startup
6
- end
7
-
8
- def setup
9
- @zstream = Zlib::ZStream.new
10
- @zfunc = Zlib::ZStreamFuncs.new
11
- @zstream.zstream_init(@zfunc)
12
- @src = Array.new(128, 0.chr)
13
- end
14
-
15
- def test_flags
16
- assert_respond_to(@zstream, :flags)
17
- assert_respond_to(@zstream, :flags=)
18
- end
19
-
20
- def test_buf
21
- assert_respond_to(@zstream, :buf)
22
- assert_respond_to(@zstream, :buf=)
23
- end
24
-
25
- def test_input
26
- assert_respond_to(@zstream, :input)
27
- assert_respond_to(@zstream, :input=)
28
- end
29
-
30
- def test_stream
31
- assert_respond_to(@zstream, :stream)
32
- assert_respond_to(@zstream, :stream=)
33
- end
34
-
35
- def test_func
36
- assert_respond_to(@zstream, :func)
37
- assert_respond_to(@zstream, :func=)
38
- end
39
-
40
- def test_raise_zlib_error_basic
41
- assert_respond_to(@zstream, :raise_zlib_error)
42
- end
43
-
44
- def test_raise_zlib_error_stream_end
45
- assert_raise(Zlib::StreamEnd){ @zstream.raise_zlib_error(Z_STREAM_END, nil) }
46
- assert_raise_message('stream end'){ @zstream.raise_zlib_error(Z_STREAM_END, nil) }
47
- end
48
-
49
- def test_raise_zlib_error_need_dict
50
- assert_raise(Zlib::NeedDict){ @zstream.raise_zlib_error(Z_NEED_DICT, nil) }
51
- assert_raise_message('need dictionary'){ @zstream.raise_zlib_error(Z_NEED_DICT, nil) }
52
- end
53
-
54
- def test_raise_zlib_error_stream_error
55
- assert_raise(Zlib::StreamError){ @zstream.raise_zlib_error(Z_STREAM_ERROR, nil) }
56
- assert_raise_message('stream error'){ @zstream.raise_zlib_error(Z_STREAM_ERROR, nil) }
57
- end
58
-
59
- def test_raise_zlib_error_data_error
60
- assert_raise(Zlib::DataError){ @zstream.raise_zlib_error(Z_DATA_ERROR, nil) }
61
- assert_raise_message('data error'){ @zstream.raise_zlib_error(Z_DATA_ERROR, nil) }
62
- end
63
-
64
- def test_raise_zlib_error_buf_error
65
- assert_raise(Zlib::BufError){ @zstream.raise_zlib_error(Z_BUF_ERROR, nil) }
66
- assert_raise_message('buffer error'){ @zstream.raise_zlib_error(Z_BUF_ERROR, nil) }
67
- end
68
-
69
- def test_raise_zlib_error_version_error
70
- assert_raise(Zlib::VersionError){ @zstream.raise_zlib_error(Z_VERSION_ERROR, nil) }
71
- assert_raise_message('incompatible version'){ @zstream.raise_zlib_error(Z_VERSION_ERROR, nil) }
72
- end
73
-
74
- def test_raise_zlib_error_mem_error
75
- assert_raise(Zlib::MemError){ @zstream.raise_zlib_error(Z_MEM_ERROR, nil) }
76
- assert_raise_message('insufficient memory'){ @zstream.raise_zlib_error(Z_MEM_ERROR, nil) }
77
- end
78
-
79
- def test_raise_zlib_error_errno
80
- assert_raise(SystemCallError){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
81
- assert_raise_message('unknown error - file error'){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
82
- end
83
-
84
- def test_raise_zlib_error_unknown
85
- #notify('I think there might be a problem here - need to investigate')
86
- assert_raise(Zlib::Error){ @zstream.raise_zlib_error(999, nil) }
87
- assert_raise_message('unknown error - file error'){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
88
- end
89
-
90
- def test_zstream_expand_buffer_basic
91
- assert_respond_to(@zstream, :zstream_expand_buffer)
92
- assert_nothing_raised{ @zstream.zstream_expand_buffer }
93
- end
94
-
95
- # @zstream.buf set after call
96
- def test_zstream_expand_buffer
97
- assert_nil(@zstream.buf)
98
- assert_nil(@zstream.zstream_expand_buffer)
99
- assert_kind_of(Bytef, @zstream.buf)
100
- end
101
-
102
- def test_zstream_expand_buffer_expected_errors
103
- #notify("Modify zstream_expand_buffer method to explicitly handle a nil @stream")
104
- assert_raise(ArgumentError){ @zstream.zstream_expand_buffer(1) }
105
- end
106
-
107
- def test_zstream_append_buffer_basic
108
- assert_respond_to(@zstream, :zstream_append_buffer)
109
- assert_nothing_raised{ @zstream.zstream_append_buffer(@src, @src.length) }
110
- end
111
-
112
- # @zstream.buf set after call
113
- def test_zstream_append_buffer
114
- assert_nil(@zstream.buf)
115
- assert_nil(@zstream.zstream_append_buffer(@src, @src.length))
116
- assert_kind_of(Bytef, @zstream.buf)
117
- end
118
-
119
- def test_zstream_append_buffer_expected_errors
120
- assert_raise(ArgumentError){ @zstream.zstream_append_buffer }
121
- end
122
-
123
- def test_zstream_detach_buffer_basic
124
- assert_respond_to(@zstream, :zstream_detach_buffer)
125
- assert_nothing_raised{ @zstream.zstream_detach_buffer }
126
- end
127
-
128
- def test_zstream_detach_buffer
129
- assert_kind_of(String, @zstream.zstream_detach_buffer)
130
- assert_not_nil(@zstream.buf)
131
- end
132
-
133
- def test_zstream_shift_buffer_basic
134
- @zstream.buf = Bytef.new(0.chr * Zlib::ZSTREAM_INITIAL_BUFSIZE)
135
- assert_respond_to(@zstream, :zstream_shift_buffer)
136
- assert_nothing_raised{ @zstream.zstream_shift_buffer(1) }
137
- end
138
-
139
- def teardown
140
- @zstream = nil
141
- @src = nil
142
- end
143
-
144
- def self.shutdown
145
- end
146
- end
1
+ require 'test-unit'
2
+ require 'pr/zlib'
3
+
4
+ class TC_Zlib_Zstream < Test::Unit::TestCase
5
+ def self.startup
6
+ end
7
+
8
+ def setup
9
+ @zstream = Zlib::ZStream.new
10
+ @zfunc = Zlib::ZStreamFuncs.new
11
+ @zstream.zstream_init(@zfunc)
12
+ @src = Array.new(128, 0.chr)
13
+ end
14
+
15
+ def test_flags
16
+ assert_respond_to(@zstream, :flags)
17
+ assert_respond_to(@zstream, :flags=)
18
+ end
19
+
20
+ def test_buf
21
+ assert_respond_to(@zstream, :buf)
22
+ assert_respond_to(@zstream, :buf=)
23
+ end
24
+
25
+ def test_input
26
+ assert_respond_to(@zstream, :input)
27
+ assert_respond_to(@zstream, :input=)
28
+ end
29
+
30
+ def test_stream
31
+ assert_respond_to(@zstream, :stream)
32
+ assert_respond_to(@zstream, :stream=)
33
+ end
34
+
35
+ def test_func
36
+ assert_respond_to(@zstream, :func)
37
+ assert_respond_to(@zstream, :func=)
38
+ end
39
+
40
+ def test_raise_zlib_error_basic
41
+ assert_respond_to(@zstream, :raise_zlib_error)
42
+ end
43
+
44
+ def test_raise_zlib_error_stream_end
45
+ assert_raise(Zlib::StreamEnd){ @zstream.raise_zlib_error(Z_STREAM_END, nil) }
46
+ assert_raise_message('stream end'){ @zstream.raise_zlib_error(Z_STREAM_END, nil) }
47
+ end
48
+
49
+ def test_raise_zlib_error_need_dict
50
+ assert_raise(Zlib::NeedDict){ @zstream.raise_zlib_error(Z_NEED_DICT, nil) }
51
+ assert_raise_message('need dictionary'){ @zstream.raise_zlib_error(Z_NEED_DICT, nil) }
52
+ end
53
+
54
+ def test_raise_zlib_error_stream_error
55
+ assert_raise(Zlib::StreamError){ @zstream.raise_zlib_error(Z_STREAM_ERROR, nil) }
56
+ assert_raise_message('stream error'){ @zstream.raise_zlib_error(Z_STREAM_ERROR, nil) }
57
+ end
58
+
59
+ def test_raise_zlib_error_data_error
60
+ assert_raise(Zlib::DataError){ @zstream.raise_zlib_error(Z_DATA_ERROR, nil) }
61
+ assert_raise_message('data error'){ @zstream.raise_zlib_error(Z_DATA_ERROR, nil) }
62
+ end
63
+
64
+ def test_raise_zlib_error_buf_error
65
+ assert_raise(Zlib::BufError){ @zstream.raise_zlib_error(Z_BUF_ERROR, nil) }
66
+ assert_raise_message('buffer error'){ @zstream.raise_zlib_error(Z_BUF_ERROR, nil) }
67
+ end
68
+
69
+ def test_raise_zlib_error_version_error
70
+ assert_raise(Zlib::VersionError){ @zstream.raise_zlib_error(Z_VERSION_ERROR, nil) }
71
+ assert_raise_message('incompatible version'){ @zstream.raise_zlib_error(Z_VERSION_ERROR, nil) }
72
+ end
73
+
74
+ def test_raise_zlib_error_mem_error
75
+ assert_raise(Zlib::MemError){ @zstream.raise_zlib_error(Z_MEM_ERROR, nil) }
76
+ assert_raise_message('insufficient memory'){ @zstream.raise_zlib_error(Z_MEM_ERROR, nil) }
77
+ end
78
+
79
+ def test_raise_zlib_error_errno
80
+ assert_raise(SystemCallError){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
81
+ assert_raise_message('unknown error - file error'){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
82
+ end
83
+
84
+ def test_raise_zlib_error_unknown
85
+ #notify('I think there might be a problem here - need to investigate')
86
+ assert_raise(Zlib::Error){ @zstream.raise_zlib_error(999, nil) }
87
+ assert_raise_message('unknown error - file error'){ @zstream.raise_zlib_error(Z_ERRNO, nil) }
88
+ end
89
+
90
+ def test_zstream_expand_buffer_basic
91
+ assert_respond_to(@zstream, :zstream_expand_buffer)
92
+ assert_nothing_raised{ @zstream.zstream_expand_buffer }
93
+ end
94
+
95
+ # @zstream.buf set after call
96
+ def test_zstream_expand_buffer
97
+ assert_nil(@zstream.buf)
98
+ assert_nil(@zstream.zstream_expand_buffer)
99
+ assert_kind_of(Bytef_str, @zstream.buf)
100
+ end
101
+
102
+ def test_zstream_expand_buffer_expected_errors
103
+ #notify("Modify zstream_expand_buffer method to explicitly handle a nil @stream")
104
+ assert_raise(ArgumentError){ @zstream.zstream_expand_buffer(1) }
105
+ end
106
+
107
+ def test_zstream_append_buffer_basic
108
+ assert_respond_to(@zstream, :zstream_append_buffer)
109
+ assert_nothing_raised{ @zstream.zstream_append_buffer(@src, @src.length) }
110
+ end
111
+
112
+ # @zstream.buf set after call
113
+ def test_zstream_append_buffer
114
+ assert_nil(@zstream.buf)
115
+ assert_nil(@zstream.zstream_append_buffer(@src, @src.length))
116
+ assert_kind_of(Bytef_arr, @zstream.buf)
117
+ end
118
+
119
+ def test_zstream_append_buffer_expected_errors
120
+ assert_raise(ArgumentError){ @zstream.zstream_append_buffer }
121
+ end
122
+
123
+ def test_zstream_detach_buffer_basic
124
+ assert_respond_to(@zstream, :zstream_detach_buffer)
125
+ assert_nothing_raised{ @zstream.zstream_detach_buffer }
126
+ end
127
+
128
+ def test_zstream_detach_buffer
129
+ assert_kind_of(String, @zstream.zstream_detach_buffer)
130
+ assert_not_nil(@zstream.buf)
131
+ end
132
+
133
+ def test_zstream_shift_buffer_basic
134
+ @zstream.buf = Bytef.new(0.chr * Zlib::ZSTREAM_INITIAL_BUFSIZE)
135
+ assert_respond_to(@zstream, :zstream_shift_buffer)
136
+ assert_nothing_raised{ @zstream.zstream_shift_buffer(1) }
137
+ end
138
+
139
+ def teardown
140
+ @zstream = nil
141
+ @src = nil
142
+ end
143
+
144
+ def self.shutdown
145
+ end
146
+ end
metadata CHANGED
@@ -1,15 +1,37 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pr-zlib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Park Heesob
8
8
  - Daniel Berger
9
9
  autorequire:
10
10
  bindir: bin
11
- cert_chain: []
12
- date: 2015-06-24 00:00:00.000000000 Z
11
+ cert_chain:
12
+ - |
13
+ -----BEGIN CERTIFICATE-----
14
+ MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
15
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
16
+ MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
17
+ ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
18
+ bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
19
+ Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
20
+ S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
21
+ gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
22
+ FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
23
+ zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
24
+ DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
25
+ nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv
26
+ bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD
27
+ ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7
28
+ tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC
29
+ /sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2
30
+ wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ
31
+ EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V
32
+ tGSHgAmcLlkdGgan182qsE/4kKM=
33
+ -----END CERTIFICATE-----
34
+ date: 2015-12-03 00:00:00.000000000 Z
13
35
  dependencies:
14
36
  - !ruby/object:Gem::Dependency
15
37
  name: test-unit
@@ -51,19 +73,28 @@ extra_rdoc_files:
51
73
  - CHANGES
52
74
  - MANIFEST
53
75
  files:
54
- - CHANGES
55
- - MANIFEST
56
- - README
57
- - Rakefile
76
+ - bin
58
77
  - bin/minizip.rb
78
+ - certs
79
+ - certs/djberg96_pub.pem
80
+ - CHANGES
81
+ - examples
59
82
  - examples/example_rbzlib.rb
83
+ - lib
84
+ - lib/pr
60
85
  - lib/pr/rbzlib.rb
61
86
  - lib/pr/zlib.rb
87
+ - lib/pr-zlib.rb
88
+ - MANIFEST
62
89
  - pr-zlib.gemspec
90
+ - profile
63
91
  - profile/bench_pr_zlib.rb
64
92
  - profile/bench_zlib.rb
65
93
  - profile/profile_pr_zlib_read.rb
66
94
  - profile/profile_pr_zlib_write.rb
95
+ - Rakefile
96
+ - README
97
+ - test
67
98
  - test/test_rbzlib.rb
68
99
  - test/test_rbzlib_bytef.rb
69
100
  - test/test_rbzlib_posf.rb
@@ -75,7 +106,8 @@ files:
75
106
  - test/test_zlib_inflate.rb
76
107
  - test/test_zlib_zstream.rb
77
108
  homepage: https://github.com/djberg96/pr-zlib
78
- licenses: []
109
+ licenses:
110
+ - zlib
79
111
  metadata: {}
80
112
  post_install_message:
81
113
  rdoc_options: []
@@ -93,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
125
  version: '0'
94
126
  requirements: []
95
127
  rubyforge_project:
96
- rubygems_version: 2.4.6
128
+ rubygems_version: 2.5.0
97
129
  signing_key:
98
130
  specification_version: 4
99
131
  summary: Pure Ruby version of the zlib library
Binary file