Skip to content

Conversation

gburt
Copy link

@gburt gburt commented Jan 16, 2025

Add a bunch of operator tests. We noticed that https://github.com/diegoholiveira/jsonlogic started returning false for {"==": ["0", 0]} recently but still returns true if the order of the args is reversed, {"==": [0, "0"]}. The JS library returns true for both of these.

@TotalTechGeek
Copy link

TotalTechGeek commented Jan 19, 2025

Hey @gburt, would you be interested in participating in the JSON Logic Core initiative?

https://github.com/json-logic

We've a handful of projects who've joined the org: https://github.com/orgs/json-logic/discussions/14

We ratified the existing tests.json exported as of 2024-12-19, but we're looking to add additional test cases to our test suite 😄

These are some of the currently accepted proposals: https://github.com/json-logic/.github/blob/main/ACCEPTED_PROPOSALS.md

And it seems like we're about to wrap up error handling:

And re-evaluating the arithmetic operators:

@TotalTechGeek
Copy link

TotalTechGeek commented Jan 19, 2025

This particular test will be "controversial" and needs a bit more community discussion as the comparison operator had no explicit coercion rules defined by test.json, so some implementations have implemented those comparison operators to always coerce the operands to numbers.

[ {"<":[""," "]}, {}, true ],

I'm in favor of supporting string comparison, and I believe that will be the end-result, but we'll need to specify it as an Ordinal comparison of the strings to avoid some implementations using locale by default, for maximum compatibility.

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.

2 participants