/// \brief Compares two label sequences for equality.
///
- /// Performs a (optionally case-insensitive) comparison between this
+ /// Performs a (optionally case-sensitive) comparison between this
/// LabelSequence and another LabelSequence for equality.
///
/// \param other The LabelSequence to compare with
/// and contain the same data.
bool equals(const LabelSequence& other, bool case_sensitive = false) const;
+ /// \brief Compares two label sequences for equality (case ignored).
+ ///
+ /// This is equivalent to <code>this->equals(other)</code>.
+ ///
+ /// The operator version is convenient some specific cases such as in
+ /// unit tests.
+ bool operator==(const LabelSequence& other) const {
+ return (equals(other));
+ }
+
/// \brief Compares two label sequences.
///
/// Performs a (optionally case-insensitive) comparison between this
EXPECT_TRUE(ls11.equals(ls12));
}
+// operator==(). This is mostly trivial wrapper, so it should suffice to
+// check some basic cases.
+TEST_F(LabelSequenceTest, operatorEqual) {
+ EXPECT_TRUE(ls1 == ls1); // self equivalence
+ EXPECT_TRUE(ls1 == LabelSequence(n1)); // equivalent two different objects
+ EXPECT_FALSE(ls1 == ls2); // non equivalent objects
+ EXPECT_TRUE(ls1 == ls5); // it's always case insensitive
+}
+
// Compare tests
TEST_F(LabelSequenceTest, compare) {
// "example.org." and "example.org.", case sensitive