Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

CRC64Checksum test #944 - #951

Merged
josemduarte merged 4 commits into
biojava:masterfrom
richarda23:crc64checksumtest
Aug 16, 2021
Merged

josemduarte merged 4 commits into
biojava:masterfrom
richarda23:crc64checksumtest

Conversation

@richarda23

@richarda23 richarda23 commented Jul 31, 2021 •

Copy link
Copy Markdown
Contributor

Test for basic behaviour of Crc64Checksum - #944

I think there is a bug exposed by test partialbyteRange() and I've proposed a solution in the Crc64Checksum class.

@sbliven sbliven left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for these tests! Improving our code coverage is great. The CRC64Checksum class seems to have been copied from expasy4j, so it

Regarding the partialbyteRange test, I'm not sure that this captures the intended behavior. Is the function used like this elsewhere? Unless there's a good reason to change it, I would prefer making this test pass now and then fixing any places that are expecting (bytes, start, length) at the caller.

@Disabled
// this doesn't work as expected
// and doesn't behave according to interface. The 3rd argument
// is treated as an index rather than a number of bytes to include

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks to me that the function is intended to take (bytes, start, end) rather than (bytes, start, length). I think this is a failure with the documentation (both non-existent javadoc and the misleadingly named parameters). It looks like it should run as expected with crc64.update(testBytes, 2, 3);.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method doesn't seem to be used anywhere internally in BioJava. The behaviour is specified in the interface java.util.zip.Checksum which this class implements (javadoc reproduced below). Since this is an interface in the standard Java library we can't change the contract of the interface. If we assume that there is some external client code using this method, then from their point of view fixing this might be a breaking change, but this would be OK if it's documented and is in version 6?

 Updates the current checksum with the specified array of bytes.
     *
     * @param b the byte array to update the checksum with
     * @param off the start offset of the data
     * @param len the number of bytes to use for the update

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be ok introducing the breaking change for 6.0.0. For sure we should document it in the CHANGELOG

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed this fix and updated the changelog.
Also, added some input validation, following example of java.util.zip.CRC32 implementation

@richarda23 richarda23 changed the title CRC64Checksum test CRC64Checksum test #944 Aug 2, 2021

@josemduarte josemduarte left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! LGTM

@richarda23

Copy link
Copy Markdown
Contributor Author

Hi.
this is still showing up as 'changes requested' but I think they are fixed and approved, should I do anything more?

@josemduarte

Copy link
Copy Markdown
Contributor

I think @sbliven would have to approve. In any case, I think his comments were addressed. Let's give it a couple of days and then merge.

@josemduarte
josemduarte merged commit b4d1e90 into biojava:master Aug 16, 2021
@richarda23
richarda23 deleted the crc64checksumtest branch August 17, 2021 07:45
jnbdz pushed a commit to jnbdz/biojava that referenced this pull request Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants