src: Add inequality operator for StringRef
This commit is contained in:
parent
919e9eee63
commit
d5efab4993
|
@ -342,6 +342,22 @@ inline bool operator==(const char *lhs, const StringRef &rhs) {
|
|||
return rhs == lhs;
|
||||
}
|
||||
|
||||
inline bool operator!=(const StringRef &lhs, const std::string &rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator!=(const std::string &lhs, const StringRef &rhs) {
|
||||
return !(rhs == lhs);
|
||||
}
|
||||
|
||||
inline bool operator!=(const StringRef &lhs, const char *rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
inline bool operator!=(const char *lhs, const StringRef &rhs) {
|
||||
return !(rhs == lhs);
|
||||
}
|
||||
|
||||
inline int run_app(std::function<int(int, char **)> app, int argc,
|
||||
char **argv) {
|
||||
try {
|
||||
|
|
|
@ -87,6 +87,14 @@ void test_template_immutable_string(void) {
|
|||
|
||||
CU_ASSERT("bravo" == from_lit);
|
||||
CU_ASSERT(5 == from_lit.size());
|
||||
|
||||
// equality
|
||||
ImmutableString eq("delta");
|
||||
|
||||
CU_ASSERT("delta1" != eq);
|
||||
CU_ASSERT("delt" != eq);
|
||||
CU_ASSERT(eq != "delta1");
|
||||
CU_ASSERT(eq != "delt");
|
||||
}
|
||||
|
||||
void test_template_string_ref(void) {
|
||||
|
|
Loading…
Reference in New Issue