Commit 2a4e0555 authored by Milo Yip's avatar Milo Yip

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

Failing comparisons between certain (Ui|I)nt64 numbers
parents ab8416e1 fd2ba0bc
...@@ -662,7 +662,7 @@ public: ...@@ -662,7 +662,7 @@ public:
return StringEqual(rhs); return StringEqual(rhs);
case kNumberType: case kNumberType:
if (IsDouble() || rhs.GetDouble()) if (IsDouble() || rhs.IsDouble())
return GetDouble() == rhs.GetDouble(); // May convert one operand from integer to double. return GetDouble() == rhs.GetDouble(); // May convert one operand from integer to double.
else else
return data_.n.u64 == rhs.data_.n.u64; return data_.n.u64 == rhs.data_.n.u64;
......
...@@ -135,6 +135,11 @@ TEST(Value, equalto_operator) { ...@@ -135,6 +135,11 @@ TEST(Value, equalto_operator) {
TestEqual(x, y); TestEqual(x, y);
TestEqual(y, z); TestEqual(y, z);
TestEqual(z, x); 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> template <typename Value>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment