diff options
author | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2013-04-23 19:35:18 -0400 |
---|---|---|
committer | Chris Dyer <cdyer@allegro.clab.cs.cmu.edu> | 2013-04-23 19:35:18 -0400 |
commit | c164dc0ed8a32e4095ba1b36495e0f743b8cc1ea (patch) | |
tree | 78b81e4c63adfa67adb7b8f80c3e6be87b4a2b2a /extractor/mocks/mock_rule_extractor_helper.h | |
parent | 0e46089cafa4e8e2f060e370d7afaceeda6b90a9 (diff) | |
parent | d467e14b28085809c31431be0478eb3d9322fe96 (diff) |
merge paul's extractor code
Diffstat (limited to 'extractor/mocks/mock_rule_extractor_helper.h')
-rw-r--r-- | extractor/mocks/mock_rule_extractor_helper.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/extractor/mocks/mock_rule_extractor_helper.h b/extractor/mocks/mock_rule_extractor_helper.h new file mode 100644 index 00000000..468468f6 --- /dev/null +++ b/extractor/mocks/mock_rule_extractor_helper.h @@ -0,0 +1,82 @@ +#include <gmock/gmock.h> + +#include <vector> + +#include "rule_extractor_helper.h" + +using namespace std; + +namespace extractor { + +typedef unordered_map<int, int> Indexes; + +class MockRuleExtractorHelper : public RuleExtractorHelper { + public: + MOCK_CONST_METHOD5(GetLinksSpans, void(vector<int>&, vector<int>&, + vector<int>&, vector<int>&, int)); + MOCK_CONST_METHOD4(CheckAlignedTerminals, bool(const vector<int>&, + const vector<int>&, const vector<int>&, int)); + MOCK_CONST_METHOD4(CheckTightPhrases, bool(const vector<int>&, + const vector<int>&, const vector<int>&, int)); + MOCK_CONST_METHOD1(GetGapOrder, vector<int>(const vector<pair<int, int> >&)); + MOCK_CONST_METHOD4(GetSourceIndexes, Indexes(const vector<int>&, + const vector<int>&, int, int)); + + // We need to implement these methods, because Google Mock doesn't support + // methods with more than 10 arguments. + bool FindFixPoint( + int, int, const vector<int>&, const vector<int>&, int& target_phrase_low, + int& target_phrase_high, const vector<int>&, const vector<int>&, + int& source_back_low, int& source_back_high, int, int, int, int, bool, + bool, bool) const { + target_phrase_low = this->target_phrase_low; + target_phrase_high = this->target_phrase_high; + source_back_low = this->source_back_low; + source_back_high = this->source_back_high; + return find_fix_point; + } + + bool GetGaps(vector<pair<int, int> >& source_gaps, + vector<pair<int, int> >& target_gaps, + const vector<int>&, const vector<int>&, const vector<int>&, + const vector<int>&, const vector<int>&, const vector<int>&, + int, int, int, int, int, int, int& num_symbols, + bool& met_constraints) const { + source_gaps = this->source_gaps; + target_gaps = this->target_gaps; + num_symbols = this->num_symbols; + met_constraints = this->met_constraints; + return get_gaps; + } + + void SetUp( + int target_phrase_low, int target_phrase_high, int source_back_low, + int source_back_high, bool find_fix_point, + vector<pair<int, int> > source_gaps, vector<pair<int, int> > target_gaps, + int num_symbols, bool met_constraints, bool get_gaps) { + this->target_phrase_low = target_phrase_low; + this->target_phrase_high = target_phrase_high; + this->source_back_low = source_back_low; + this->source_back_high = source_back_high; + this->find_fix_point = find_fix_point; + this->source_gaps = source_gaps; + this->target_gaps = target_gaps; + this->num_symbols = num_symbols; + this->met_constraints = met_constraints; + this->get_gaps = get_gaps; + } + + private: + int target_phrase_low; + int target_phrase_high; + int source_back_low; + int source_back_high; + bool find_fix_point; + vector<pair<int, int> > source_gaps; + vector<pair<int, int> > target_gaps; + int num_symbols; + bool met_constraints; + bool get_gaps; +}; + +} // namespace extractor |