summaryrefslogtreecommitdiff
path: root/test/zlib
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-04-02 16:06:11 +0900
committergit <svn-admin@ruby-lang.org>2022-04-02 17:01:33 +0900
commit1cbdedec895070df1df96d05370cf8da084ab6fa (patch)
tree3f905cd687bdbbe8e5ce873a38984c363dfb3c8e /test/zlib
parent729b9a85439d5cec7b73f8c0c41c4377e6ce304c (diff)
[ruby/zlib] Mask checksums to lower 32bits
Upper bits affect the result of `crc32` in zlib 1.2.12. https://github.com/ruby/zlib/commit/9ab6d04af1
Diffstat (limited to 'test/zlib')
-rw-r--r--test/zlib/test_zlib.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb
index a9de827ca8..00a13af95b 100644
--- a/test/zlib/test_zlib.rb
+++ b/test/zlib/test_zlib.rb
@@ -1303,6 +1303,7 @@ if defined? Zlib
assert_equal(0x02820145, Zlib.adler32("foo"))
assert_equal(0x02820145, Zlib.adler32("o", Zlib.adler32("fo")))
assert_equal(0x8a62c964, Zlib.adler32("abc\x01\x02\x03" * 10000))
+ assert_equal(0x97d1a9f7, Zlib.adler32("p", -305419897))
Tempfile.create("test_zlib_gzip_file_to_io") {|t|
File.binwrite(t.path, "foo")
t.rewind
@@ -1338,6 +1339,7 @@ if defined? Zlib
assert_equal(0x8c736521, Zlib.crc32("foo"))
assert_equal(0x8c736521, Zlib.crc32("o", Zlib.crc32("fo")))
assert_equal(0x07f0d68f, Zlib.crc32("abc\x01\x02\x03" * 10000))
+ assert_equal(0xf136439b, Zlib.crc32("p", -305419897))
Tempfile.create("test_zlib_gzip_file_to_io") {|t|
File.binwrite(t.path, "foo")
t.rewind