This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-compress.git
The following commit(s) were added to refs/heads/master by this push: new e6aa2f48a Add ZipEightByteIntegerTest.testBIFromMaxValue() new 0f0ac4afc Merge branch 'master' of https://gitbox.apache.org/repos/asf/commons-compress.git e6aa2f48a is described below commit e6aa2f48acfc399d7b2b260afc947a34fd35c3e4 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Tue Nov 26 08:10:12 2024 -0500 Add ZipEightByteIntegerTest.testBIFromMaxValue() --- .../compress/archivers/zip/ZipEightByteIntegerTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java index 7c742c68b..5f4992cf6 100644 --- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java +++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipEightByteIntegerTest.java @@ -39,6 +39,18 @@ public class ZipEightByteIntegerTest { assertEquals(BigInteger.valueOf(Long.MAX_VALUE).shiftLeft(1), zl.getValue(), "value from bytes"); } + /** + * Test conversion from max value. + */ + @Test + public void testBIFromMaxValue() { + // https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT + // 4.4.1.1 All fields unless otherwise noted are unsigned and stored in Intel low-byte:high-byte, low-word:high-word order. + final ZipEightByteInteger zipEightByteInteger = new ZipEightByteInteger( + new byte[] { (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF }); + assertEquals("18446744073709551615", zipEightByteInteger.getValue().toString()); + } + /** * Test conversion to bytes. */