mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 19:52:54 +01:00
[MsgPack] Added a convenience operator
Summary: Added "not equal to" operator for DocNode comparison Reviewers: arsenm, scott.linder, saiislam Reviewed By: saiislam Subscribers: wdng, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D81250
This commit is contained in:
parent
c8d9beb0e3
commit
8f2bd3832b
@ -181,6 +181,11 @@ public:
|
||||
return !(Lhs < Rhs) && !(Rhs < Lhs);
|
||||
}
|
||||
|
||||
/// Inequality operator
|
||||
friend bool operator!=(const DocNode &Lhs, const DocNode &Rhs) {
|
||||
return !(Lhs == Rhs);
|
||||
}
|
||||
|
||||
/// Convert this node to a string, assuming it is scalar.
|
||||
std::string toString() const;
|
||||
|
||||
|
@ -13,6 +13,16 @@
|
||||
using namespace llvm;
|
||||
using namespace msgpack;
|
||||
|
||||
TEST(MsgPackDocument, DocNodeTest) {
|
||||
Document Doc;
|
||||
|
||||
DocNode Int1 = Doc.getNode(1), Int2 = Doc.getNode(2);
|
||||
DocNode Str1 = Doc.getNode("ab"), Str2 = Doc.getNode("ab");
|
||||
|
||||
ASSERT_TRUE(Int1 != Int2);
|
||||
ASSERT_TRUE(Str1 == Str2);
|
||||
}
|
||||
|
||||
TEST(MsgPackDocument, TestReadInt) {
|
||||
Document Doc;
|
||||
bool Ok = Doc.readFromBlob(StringRef("\xd0\x00", 2), /*Multi=*/false);
|
||||
|
Loading…
Reference in New Issue
Block a user