google / open-location-code

Open Location Code is a library to generate short codes, called "plus codes", that can be used as digital addresses where street addresses don't exist.
https://plus.codes
Apache License 2.0
4.06k stars 471 forks source link

Document special test cases #447

Closed fulldecent closed 3 years ago

fulldecent commented 3 years ago

All test cases should have written-out explanations which points to relevant specifications and how you can verify they are correct.

But especially so for something labeled "Special cases"!

@drinckes could you please help to add more documentation in the test case comments here? https://github.com/google/open-location-code/blame/master/test_data/decoding.csv#L19-L24

bocops commented 3 years ago

Those cases apparently were lost in translation when splitting the original test file for both decoding and encoding into separate test files for each. Previous test data can be found in this diff: https://github.com/google/open-location-code/commit/791c604da390a2a418e275fc0105e15864dedb28#diff-e7d87b738825c33824cf3fd32b7314161fc8c425129163ff5e7260fc7288da36

Special cases over 90 latitude and 180 longitude

CFX30000+,90,1,89,1,90,2 CFX30000+,92,1,89,1,90,2 62H20000+,1,180,1,-180,2,-179 62H30000+,1,181,1,-179,2,-178 CFX3X2X2+X2,90,1,89.9998750,1,90,1.0001250

The important part for these tests still lives in encoding.csv, where the existing comment seems to be enough documentation: https://github.com/google/open-location-code/blob/a323e80159d6d6170158cc22497250cb86bf3583/test_data/encoding.csv#L19-L28

The decoding direction IMO contains no special case, meaning that the tests can probably just be removed from decoding.csv.