json
json copied to clipboard
Inconsistent behavior for equality checks in tests
Currently some test cases use a helper equal function defined in test/test.hpp to check the equality between json::values.
https://github.com/boostorg/json/blob/ee8d72d8502b409b5561200299cad30ccdb91415/test/test.hpp#L971-L1054
Its behavior is inconsistent with the operator== of json::value as it distinguishes the cases of int64 and uint64.
The point of equal in the test is to check for bitwise equality. This is a different use-case than operator==. Otherwise, the tests would just use == instead of calling equal :)
Ah equality over wires... ok, got it.
Ah equality over wires
Not exactly "wire" but rather, that the tests expect a bitwise equality instead of a semantic equality (which could invalidate the test). In other words this version of equal is specifically for helping the tests ensure that the correct bit-patterns are produced. We could rename this if it would help (bitwise_equal?)
Yes, renaming the helper function would prevent the confusion.