diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-02-22 11:59:17 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-02-22 11:59:17 +0000 |
commit | d69c289e172562039bcbe987657280332ab6315e (patch) | |
tree | cc67d97bf802101d981cfacadb1cea80472aa107 /extractor/matching_comparator_test.cc | |
parent | a21835881984ba90f303c7b1681d295678cb7131 (diff) |
Remove original version of the intersector.
Diffstat (limited to 'extractor/matching_comparator_test.cc')
-rw-r--r-- | extractor/matching_comparator_test.cc | 139 |
1 files changed, 0 insertions, 139 deletions
diff --git a/extractor/matching_comparator_test.cc b/extractor/matching_comparator_test.cc deleted file mode 100644 index b8f898cf..00000000 --- a/extractor/matching_comparator_test.cc +++ /dev/null @@ -1,139 +0,0 @@ -#include <gtest/gtest.h> - -#include "matching.h" -#include "matching_comparator.h" - -using namespace ::testing; - -namespace { - -class MatchingComparatorTest : public Test { - protected: - virtual void SetUp() { - comparator = make_shared<MatchingComparator>(1, 20); - } - - shared_ptr<MatchingComparator> comparator; -}; - -TEST_F(MatchingComparatorTest, SmallerSentenceId) { - vector<int> left_locations{1}; - Matching left(left_locations.begin(), 1, 1); - vector<int> right_locations{100}; - Matching right(right_locations.begin(), 1, 5); - EXPECT_EQ(-1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, GreaterSentenceId) { - vector<int> left_locations{100}; - Matching left(left_locations.begin(), 1, 5); - vector<int> right_locations{1}; - Matching right(right_locations.begin(), 1, 1); - EXPECT_EQ(1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, SmalleraXb) { - vector<int> left_locations{1}; - Matching left(left_locations.begin(), 1, 1); - vector<int> right_locations{21}; - Matching right(right_locations.begin(), 1, 1); - // The matching exceeds the max rule span. - EXPECT_EQ(-1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, EqualaXb) { - vector<int> left_locations{1}; - Matching left(left_locations.begin(), 1, 1); - vector<int> lower_right_locations{3}; - Matching right(lower_right_locations.begin(), 1, 1); - EXPECT_EQ(0, comparator->Compare(left, right, 1, true)); - - vector<int> higher_right_locations{20}; - right = Matching(higher_right_locations.begin(), 1, 1); - EXPECT_EQ(0, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, GreateraXb) { - vector<int> left_locations{1}; - Matching left(left_locations.begin(), 1, 1); - vector<int> right_locations{2}; - Matching right(right_locations.begin(), 1, 1); - // The gap between the prefix and the suffix is of size 0, less than the - // min gap size. - EXPECT_EQ(1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, SmalleraXbXc) { - vector<int> left_locations{1, 3}; - Matching left(left_locations.begin(), 2, 1); - vector<int> right_locations{4, 6}; - // The common part doesn't match. - Matching right(right_locations.begin(), 2, 1); - EXPECT_EQ(-1, comparator->Compare(left, right, 1, true)); - - // The common part matches, but the rule exceeds the max span. - vector<int> other_right_locations{3, 21}; - right = Matching(other_right_locations.begin(), 2, 1); - EXPECT_EQ(-1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, EqualaXbXc) { - vector<int> left_locations{1, 3}; - Matching left(left_locations.begin(), 2, 1); - vector<int> right_locations{3, 5}; - // The leftmost possible match. - Matching right(right_locations.begin(), 2, 1); - EXPECT_EQ(0, comparator->Compare(left, right, 1, true)); - - // The rightmost possible match. - vector<int> other_right_locations{3, 20}; - right = Matching(other_right_locations.begin(), 2, 1); - EXPECT_EQ(0, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, GreateraXbXc) { - vector<int> left_locations{1, 4}; - Matching left(left_locations.begin(), 2, 1); - vector<int> right_locations{3, 5}; - // The common part doesn't match. - Matching right(right_locations.begin(), 2, 1); - EXPECT_EQ(1, comparator->Compare(left, right, 1, true)); -} - -TEST_F(MatchingComparatorTest, SmallerabXcXd) { - vector<int> left_locations{9, 13}; - Matching left(left_locations.begin(), 2, 1); - // The suffix doesn't start on the next position. - vector<int> right_locations{11, 13, 15}; - Matching right(right_locations.begin(), 3, 1); - EXPECT_EQ(-1, comparator->Compare(left, right, 1, false)); - - // The common part doesn't match. - vector<int> other_right_locations{10, 16, 18}; - right = Matching(other_right_locations.begin(), 3, 1); - EXPECT_EQ(-1, comparator->Compare(left, right, 1, false)); -} - -TEST_F(MatchingComparatorTest, EqualabXcXd) { - vector<int> left_locations{10, 13}; - Matching left(left_locations.begin(), 2, 1); - vector<int> right_locations{11, 13, 15}; - Matching right(right_locations.begin(), 3, 1); - EXPECT_EQ(0, comparator->Compare(left, right, 1, false)); -} - -TEST_F(MatchingComparatorTest, GreaterabXcXd) { - vector<int> left_locations{9, 15}; - Matching left(left_locations.begin(), 2, 1); - // The suffix doesn't start on the next position. - vector<int> right_locations{7, 15, 17}; - Matching right(right_locations.begin(), 3, 1); - EXPECT_EQ(1, comparator->Compare(left, right, 1, false)); - - // The common part doesn't match. - vector<int> other_right_locations{10, 13, 16}; - right = Matching(other_right_locations.begin(), 3, 1); - EXPECT_EQ(1, comparator->Compare(left, right, 1, false)); -} - -} // namespace |