diff options
author | Paul Baltescu <pauldb89@gmail.com> | 2013-01-28 11:56:31 +0000 |
---|---|---|
committer | Paul Baltescu <pauldb89@gmail.com> | 2013-01-28 11:56:31 +0000 |
commit | 5530575ae0ad939e17f08d6bd49978acea388ab7 (patch) | |
tree | 4620a276c1c827d824e285148f4f4a5bf781ebfe /extractor/mocks | |
parent | ce6937f136a38af93d9a5cd9628acc712da95543 (diff) |
Initial working commit.
Diffstat (limited to 'extractor/mocks')
-rw-r--r-- | extractor/mocks/mock_data_array.h | 14 | ||||
-rw-r--r-- | extractor/mocks/mock_linear_merger.h | 21 | ||||
-rw-r--r-- | extractor/mocks/mock_suffix_array.h | 17 | ||||
-rw-r--r-- | extractor/mocks/mock_vocabulary.h | 8 |
4 files changed, 60 insertions, 0 deletions
diff --git a/extractor/mocks/mock_data_array.h b/extractor/mocks/mock_data_array.h new file mode 100644 index 00000000..cda8f7a6 --- /dev/null +++ b/extractor/mocks/mock_data_array.h @@ -0,0 +1,14 @@ +#include <gmock/gmock.h> + +#include "../data_array.h" + +class MockDataArray : public DataArray { + public: + MOCK_CONST_METHOD0(GetData, const vector<int>&()); + MOCK_CONST_METHOD1(AtIndex, int(int index)); + MOCK_CONST_METHOD0(GetSize, int()); + MOCK_CONST_METHOD0(GetVocabularySize, int()); + MOCK_CONST_METHOD1(HasWord, bool(const string& word)); + MOCK_CONST_METHOD1(GetWordId, int(const string& word)); + MOCK_CONST_METHOD1(GetSentenceId, int(int position)); +}; diff --git a/extractor/mocks/mock_linear_merger.h b/extractor/mocks/mock_linear_merger.h new file mode 100644 index 00000000..0defa88a --- /dev/null +++ b/extractor/mocks/mock_linear_merger.h @@ -0,0 +1,21 @@ +#include <gmock/gmock.h> + +#include <vector> + +#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_suffix_array.h b/extractor/mocks/mock_suffix_array.h new file mode 100644 index 00000000..38d8bad6 --- /dev/null +++ b/extractor/mocks/mock_suffix_array.h @@ -0,0 +1,17 @@ +#include <gmock/gmock.h> + +#include <string> + +#include "../data_array.h" +#include "../phrase_location.h" +#include "../suffix_array.h" + +using namespace std; + +class MockSuffixArray : public SuffixArray { + public: + MockSuffixArray() : SuffixArray(make_shared<DataArray>()) {} + + MOCK_CONST_METHOD0(GetSize, 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 new file mode 100644 index 00000000..06dea10f --- /dev/null +++ b/extractor/mocks/mock_vocabulary.h @@ -0,0 +1,8 @@ +#include <gmock/gmock.h> + +#include "../vocabulary.h" + +class MockVocabulary : public Vocabulary { + public: + MOCK_METHOD1(GetTerminalValue, string(int word_id)); +}; |