Merge pull request #129 from pah/bug/compare-uint64-double

Failing comparisons between certain (Ui|I)nt64 numbers
This commit is contained in:
Milo Yip 2014-09-01 12:09:31 +08:00
commit 2a4e055590
2 changed files with 6 additions and 1 deletions

View File

@ -662,7 +662,7 @@ public:
return StringEqual(rhs);
case kNumberType:
if (IsDouble() || rhs.GetDouble())
if (IsDouble() || rhs.IsDouble())
return GetDouble() == rhs.GetDouble(); // May convert one operand from integer to double.
else
return data_.n.u64 == rhs.data_.n.u64;

View File

@ -135,6 +135,11 @@ TEST(Value, equalto_operator) {
TestEqual(x, y);
TestEqual(y, z);
TestEqual(z, x);
// Issue #129: compare Uint64
x.SetUint64(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFF0));
y.SetUint64(RAPIDJSON_UINT64_C2(0xFFFFFFFF, 0xFFFFFFFF));
TestUnequal(x, y);
}
template <typename Value>