Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling special bearing format + lower/upper casing + tests on invalid input #7513

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

naronchen
Copy link
Contributor

@naronchen naronchen commented Dec 23, 2024

#7489

In addition addressing casing and special strings, I added tests for out-of-bound numbers/possible invalid inputs.

Couple observations:

  1. incomplete bearing works if just missing numbers
N45E // returns 45 degree
N45:30E // returns 45.5 degree

these work as treating the missing sections as 00

  1. ignores invalid symbols/numbers
N45:00@!$:00 // returns 45 degree
N45:0030:00 // returns 45.5 degree
  1. allows first number to have negative sign but return ParseError.MathematicOperationFoundButIsNotAllowed for negative sign being on other numbers (this has to do with how Parser.isMathematicOperation is written, it skips the first element)
N-45:00:00 // returns 315 degree
N45:00:-30 // returns ParseError

4, allows numbers bigger than 90 to occur (tests added in this pr)

N100:00:00E // returns 100 degree

The parseAndProcessTokens implementation is relatively loose, which seems acceptable to me. Let me know if any behavior is unexpected.

@naronchen naronchen requested a review from a team as a code owner December 24, 2024 19:58
@naronchen naronchen requested a review from GerardasB December 24, 2024 19:58
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.

1 participant