open-location-code icon indicating copy to clipboard operation
open-location-code copied to clipboard

Fix java encoding to accept codeLength of 2 and add test cases

Open JonMcPherson opened this issue 7 years ago • 1 comments

The encoding of codes with length 2 should be allowed as specified, but the Java implementation unnecessarily limits the codeLength to a minimum length of 4 by mistake.

This bug was originally discovered by @brewmanz in the C# implementation, which inherited this bug from the Java implementation since day 1. See discussion in issue https://github.com/google/open-location-code/issues/360#issuecomment-527561196

JonMcPherson avatar Sep 03 '19 17:09 JonMcPherson

It appears that the encoding tests in most implementations do not account for expected encoding failures like the test_data/encoding.csv specifies:

expected code (empty if the input should cause an error)

https://github.com/google/open-location-code/blob/master/test_data/encoding.csv#L6 So we will need to update the tests to support expected encoding failures.

JonMcPherson avatar Sep 03 '19 18:09 JonMcPherson