From 4ab84a0be28fdb6c0c421fe5ba5e09cfa298f2d1 Mon Sep 17 00:00:00 2001 From: Paul Baltescu Date: Mon, 28 Jan 2013 11:56:31 +0000 Subject: Initial working commit. --- extractor/mocks/mock_data_array.h | 14 ++++++++++++++ extractor/mocks/mock_linear_merger.h | 21 +++++++++++++++++++++ extractor/mocks/mock_suffix_array.h | 17 +++++++++++++++++ extractor/mocks/mock_vocabulary.h | 8 ++++++++ 4 files changed, 60 insertions(+) create mode 100644 extractor/mocks/mock_data_array.h create mode 100644 extractor/mocks/mock_linear_merger.h create mode 100644 extractor/mocks/mock_suffix_array.h create mode 100644 extractor/mocks/mock_vocabulary.h (limited to 'extractor/mocks') 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 + +#include "../data_array.h" + +class MockDataArray : public DataArray { + public: + MOCK_CONST_METHOD0(GetData, const vector&()); + 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 + +#include + +#include "linear_merger.h" +#include "phrase.h" + +using namespace std; + +class MockLinearMerger: public LinearMerger { + public: + MockLinearMerger(shared_ptr vocabulary, + shared_ptr data_array, + shared_ptr comparator) : + LinearMerger(vocabulary, data_array, comparator) {} + + + MOCK_CONST_METHOD9(Merge, void(vector&, const Phrase&, const Phrase&, + vector::iterator, vector::iterator, vector::iterator, + vector::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 + +#include + +#include "../data_array.h" +#include "../phrase_location.h" +#include "../suffix_array.h" + +using namespace std; + +class MockSuffixArray : public SuffixArray { + public: + MockSuffixArray() : SuffixArray(make_shared()) {} + + 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 + +#include "../vocabulary.h" + +class MockVocabulary : public Vocabulary { + public: + MOCK_METHOD1(GetTerminalValue, string(int word_id)); +}; -- cgit v1.2.3