diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-02-01 16:11:10 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-02-01 16:11:10 +0000 |
commit | 0a53f7eca74c165b5ce1c238f1999ddf1febea55 (patch) | |
tree | 5a5231767bc2f92203711ab4aee75336b8bc2175 /extractor/mocks | |
parent | 5530575ae0ad939e17f08d6bd49978acea388ab7 (diff) |
Second working commit.
Diffstat (limited to 'extractor/mocks')
-rw-r--r-- | extractor/mocks/mock_binary_search_merger.h | 15 | ||||
-rw-r--r-- | extractor/mocks/mock_data_array.h | 1 | ||||
-rw-r--r-- | extractor/mocks/mock_linear_merger.h | 10 | ||||
-rw-r--r-- | extractor/mocks/mock_precomputation.h | 9 | ||||
-rw-r--r-- | extractor/mocks/mock_suffix_array.h | 6 | ||||
-rw-r--r-- | extractor/mocks/mock_vocabulary.h | 1 |
6 files changed, 32 insertions, 10 deletions
diff --git a/extractor/mocks/mock_binary_search_merger.h b/extractor/mocks/mock_binary_search_merger.h new file mode 100644 index 00000000..e1375ee3 --- /dev/null +++ b/extractor/mocks/mock_binary_search_merger.h @@ -0,0 +1,15 @@ +#include <gmock/gmock.h> + +#include <vector> + +#include "../binary_search_merger.h" +#include "../phrase.h" + +using namespace std; + +class MockBinarySearchMerger: public BinarySearchMerger { + public: + MOCK_CONST_METHOD9(Merge, void(vector<int>&, const Phrase&, const Phrase&, + vector<int>::iterator, vector<int>::iterator, vector<int>::iterator, + vector<int>::iterator, int, int)); +}; diff --git a/extractor/mocks/mock_data_array.h b/extractor/mocks/mock_data_array.h index cda8f7a6..54497cf5 100644 --- a/extractor/mocks/mock_data_array.h +++ b/extractor/mocks/mock_data_array.h @@ -10,5 +10,6 @@ class MockDataArray : public DataArray { MOCK_CONST_METHOD0(GetVocabularySize, int()); MOCK_CONST_METHOD1(HasWord, bool(const string& word)); MOCK_CONST_METHOD1(GetWordId, int(const string& word)); + MOCK_CONST_METHOD1(GetWord, string(int word_id)); MOCK_CONST_METHOD1(GetSentenceId, int(int position)); }; diff --git a/extractor/mocks/mock_linear_merger.h b/extractor/mocks/mock_linear_merger.h index 0defa88a..82243428 100644 --- a/extractor/mocks/mock_linear_merger.h +++ b/extractor/mocks/mock_linear_merger.h @@ -2,19 +2,13 @@ #include <vector> -#include "linear_merger.h" -#include "phrase.h" +#include "../linear_merger.h" +#include "../phrase.h" using namespace std; class MockLinearMerger: public LinearMerger { public: - MockLinearMerger(shared_ptr<Vocabulary> vocabulary, - shared_ptr<DataArray> data_array, - shared_ptr<MatchingComparator> comparator) : - LinearMerger(vocabulary, data_array, comparator) {} - - MOCK_CONST_METHOD9(Merge, void(vector<int>&, const Phrase&, const Phrase&, vector<int>::iterator, vector<int>::iterator, vector<int>::iterator, vector<int>::iterator, int, int)); diff --git a/extractor/mocks/mock_precomputation.h b/extractor/mocks/mock_precomputation.h new file mode 100644 index 00000000..987bdb2f --- /dev/null +++ b/extractor/mocks/mock_precomputation.h @@ -0,0 +1,9 @@ +#include <gmock/gmock.h> + +#include "../precomputation.h" + +class MockPrecomputation : public Precomputation { + public: + MOCK_CONST_METHOD0(GetInvertedIndex, const Index&()); + MOCK_CONST_METHOD0(GetCollocations, const Index&()); +}; diff --git a/extractor/mocks/mock_suffix_array.h b/extractor/mocks/mock_suffix_array.h index 38d8bad6..11a3a443 100644 --- a/extractor/mocks/mock_suffix_array.h +++ b/extractor/mocks/mock_suffix_array.h @@ -1,5 +1,6 @@ #include <gmock/gmock.h> +#include <memory> #include <string> #include "../data_array.h" @@ -10,8 +11,9 @@ using namespace std; class MockSuffixArray : public SuffixArray { public: - MockSuffixArray() : SuffixArray(make_shared<DataArray>()) {} - MOCK_CONST_METHOD0(GetSize, int()); + MOCK_CONST_METHOD0(GetData, shared_ptr<DataArray>()); + MOCK_CONST_METHOD0(BuildLCPArray, vector<int>()); + MOCK_CONST_METHOD1(GetSuffix, int(int)); MOCK_CONST_METHOD4(Lookup, PhraseLocation(int, int, const string& word, int)); }; diff --git a/extractor/mocks/mock_vocabulary.h b/extractor/mocks/mock_vocabulary.h index 06dea10f..e5c191f5 100644 --- a/extractor/mocks/mock_vocabulary.h +++ b/extractor/mocks/mock_vocabulary.h @@ -5,4 +5,5 @@ class MockVocabulary : public Vocabulary { public: MOCK_METHOD1(GetTerminalValue, string(int word_id)); + MOCK_METHOD1(GetTerminalIndex, int(const string& word)); }; |