Commit 36667aadba77564b326ce008b02f3e7ca804b3b5
1 parent
20aa18e3
dodanie testów CPPUnit
git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/morfeusz@236 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
Showing
20 changed files
with
914 additions
and
343 deletions
CMakeLists.txt
... | ... | @@ -15,7 +15,9 @@ set (CMAKE_BUILD_TYPE Release) |
15 | 15 | |
16 | 16 | message ("Version=${Morfeusz_VERSION}") |
17 | 17 | |
18 | -enable_testing() | |
18 | +if (NOT CMAKE_CROSSCOMPILING AND NOT SKIP_TESTING) | |
19 | + enable_testing() | |
20 | +endif () | |
19 | 21 | |
20 | 22 | ##### initialize some vars ##### |
21 | 23 | |
... | ... | @@ -159,8 +161,6 @@ add_subdirectory (fsabuilder) |
159 | 161 | |
160 | 162 | ########## add tests ########## |
161 | 163 | |
162 | -add_test(Test_C_API morfeusz/test_c_api) | |
163 | - | |
164 | 164 | #macro (test_build_and_recognize fname method) |
165 | 165 | # add_test (TestBuild-${method}-${fname} python fsabuilder/morfeusz_builder --analyzer --input-files testfiles/${fname} -o /tmp/test-${method}-${fname}.fsa --tagset-file=testfiles/polimorf.tagset --segments-file=testfiles/segmenty.dat --serialization-method=${method}) |
166 | 166 | # add_test (TestBuild4Synth-${method}-${fname} python fsabuilder/morfeusz_builder --generator --input-files testfiles/${fname} -o /tmp/test-synth-${method}-${fname}.fsa --tagset-file=testfiles/polimorf.tagset --serialization-method=${method}) |
... | ... |
morfeusz/CMakeLists.txt
... | ... | @@ -58,6 +58,8 @@ set(SRC_FILES |
58 | 58 | c_api/ResultsManager.cpp |
59 | 59 | ) |
60 | 60 | |
61 | +file (GLOB TEST_SRC_FILES tests/*.cpp) | |
62 | + | |
61 | 63 | add_library (libmorfeusz SHARED ${SRC_FILES}) |
62 | 64 | set_source_files_properties ( SOURCE "${INPUT_DICTIONARY_CPP}" PROPERTIES GENERATED TRUE) |
63 | 65 | set_source_files_properties ( SOURCE "${INPUT_SYNTH_DICTIONARY_CPP}" PROPERTIES GENERATED TRUE) |
... | ... | @@ -65,15 +67,9 @@ set_target_properties (libmorfeusz PROPERTIES OUTPUT_NAME "morfeusz2") |
65 | 67 | |
66 | 68 | add_executable (morfeusz_analyzer morfeusz_analyzer.cpp) |
67 | 69 | add_executable (morfeusz_generator morfeusz_generator.cpp) |
68 | -add_executable (test_c_api tests/test_c_api.cpp) | |
69 | -#add_executable (test_result_equals test/test_result_equals.cpp) | |
70 | -#add_executable (test_recognize_dict test/test_recognize_dict.cpp) | |
71 | 70 | |
72 | 71 | target_link_libraries (morfeusz_analyzer libmorfeusz) |
73 | 72 | target_link_libraries (morfeusz_generator libmorfeusz) |
74 | -target_link_libraries (test_c_api libmorfeusz) | |
75 | -#target_link_libraries (test_result_equals libmorfeusz) | |
76 | -#target_link_libraries (test_recognize_dict libmorfeusz) | |
77 | 73 | |
78 | 74 | add_subdirectory (wrappers) |
79 | 75 | |
... | ... | @@ -94,3 +90,16 @@ endif () |
94 | 90 | install (FILES morfeusz2.h ${PROJECT_BINARY_DIR}/morfeusz_version.h morfeusz2_c.h DESTINATION include) |
95 | 91 | install (TARGETS libmorfeusz DESTINATION ${TARGET_LIB_DIR}) |
96 | 92 | install (TARGETS morfeusz_analyzer morfeusz_generator DESTINATION bin) |
93 | + | |
94 | +# TESTING | |
95 | + | |
96 | +if (NOT CMAKE_CROSSCOMPILING AND NOT SKIP_TESTING) | |
97 | + find_library(CPPUNIT_LIB cppunit) | |
98 | + if(${CPPUNIT_LIB} STREQUAL "CPPUNIT_LIB-NOTFOUND") | |
99 | + message(FATAL_ERROR "Couldn't find cppunit library. Please install cppunit or add -D SKIP_TESTING=1 option.") | |
100 | + endif() | |
101 | + add_executable (test_runner test_runner.cpp ${TEST_SRC_FILES}) | |
102 | + target_link_libraries (test_runner ${CPPUNIT_LIB} libmorfeusz) | |
103 | + add_custom_target (build-tests DEPENDS test_runner) | |
104 | + add_test(CPPUnitTests test_runner) | |
105 | +endif () | |
... | ... |
morfeusz/MorfeuszInternal.cpp
... | ... | @@ -8,6 +8,7 @@ |
8 | 8 | #include <string> |
9 | 9 | #include <iostream> |
10 | 10 | #include <vector> |
11 | +#include <cstring> | |
11 | 12 | #include "fsa/fsa.hpp" |
12 | 13 | #include "utils.hpp" |
13 | 14 | #include "data/default_fsa.hpp" |
... | ... | @@ -424,7 +425,14 @@ namespace morfeusz { |
424 | 425 | |
425 | 426 | ResultsIterator* MorfeuszInternal::analyze(const string& text) const { |
426 | 427 | adjustTokensCounter(); |
427 | - return new ResultsIteratorImpl(*this, text); | |
428 | + char* textCopy = new char[text.length() + 1]; | |
429 | + strcpy(textCopy, text.c_str()); | |
430 | + return new ResultsIteratorImpl(*this, textCopy, textCopy + text.length(), true); | |
431 | + } | |
432 | + | |
433 | + ResultsIterator* MorfeuszInternal::analyze(const char* text) const { | |
434 | + adjustTokensCounter(); | |
435 | + return new ResultsIteratorImpl(*this, text, text + strlen(text), false); | |
428 | 436 | } |
429 | 437 | |
430 | 438 | void MorfeuszInternal::analyze(const string& text, vector<MorphInterpretation>& results) const { |
... | ... |
morfeusz/MorfeuszInternal.hpp
... | ... | @@ -61,6 +61,8 @@ namespace morfeusz { |
61 | 61 | virtual ~MorfeuszInternal(); |
62 | 62 | |
63 | 63 | ResultsIterator* analyze(const std::string& text) const; |
64 | + | |
65 | + ResultsIterator* analyze(const char* text) const; | |
64 | 66 | |
65 | 67 | void analyze(const std::string& text, std::vector<MorphInterpretation>& result) const; |
66 | 68 | |
... | ... |
morfeusz/ResultsIteratorImpl.cpp
... | ... | @@ -8,25 +8,54 @@ |
8 | 8 | #include "ResultsIteratorImpl.hpp" |
9 | 9 | #include "MorfeuszInternal.hpp" |
10 | 10 | |
11 | +#include <cstring> | |
12 | + | |
11 | 13 | namespace morfeusz { |
12 | 14 | |
13 | - ResultsIteratorImpl::ResultsIteratorImpl(const MorfeuszInternal& morfeusz, const std::string& text) | |
14 | - : morfeusz(morfeusz), reader(text, morfeusz.analyzerEnv) { | |
15 | + ResultsIteratorImpl::ResultsIteratorImpl(const MorfeuszInternal& morfeusz, const char* text, const char* textEnd, bool isOwnerOfText) | |
16 | + : | |
17 | + morfeusz(morfeusz), | |
18 | + text(text), | |
19 | + isOwnerOfText(isOwnerOfText), | |
20 | + reader(text, textEnd, morfeusz.analyzerEnv), | |
21 | + buffer(), | |
22 | + bufferIterator(buffer.begin()) { | |
15 | 23 | } |
16 | - | |
24 | + | |
17 | 25 | ResultsIteratorImpl::~ResultsIteratorImpl() { |
26 | + if (isOwnerOfText) { | |
27 | + delete text; | |
28 | + } | |
18 | 29 | } |
19 | 30 | |
20 | - bool ResultsIteratorImpl::hasNext() const { | |
21 | - | |
31 | + bool ResultsIteratorImpl::hasNext() { | |
32 | + return bufferIterator != buffer.end() || tryToReadIntoBuffer(); | |
22 | 33 | } |
23 | 34 | |
24 | - const MorphInterpretation& ResultsIteratorImpl::peek() const { | |
25 | - | |
35 | + const MorphInterpretation& ResultsIteratorImpl::peek() { | |
36 | + ensureHasNext(); | |
37 | + return *bufferIterator; | |
26 | 38 | } |
27 | 39 | |
28 | 40 | MorphInterpretation ResultsIteratorImpl::next() { |
29 | - | |
41 | + ensureHasNext(); | |
42 | + return *bufferIterator++; | |
43 | + } | |
44 | + | |
45 | + void ResultsIteratorImpl::ensureHasNext() { | |
46 | + if (!hasNext()) { | |
47 | + throw MorfeuszException("No more interpretations available to ResultsIterator"); | |
48 | + } | |
49 | + } | |
50 | + | |
51 | + bool ResultsIteratorImpl::tryToReadIntoBuffer() { | |
52 | + assert(bufferIterator == buffer.end()); | |
53 | + buffer.resize(0); | |
54 | + if (!reader.isAtEnd()) { | |
55 | + morfeusz.analyzeOneWord(reader, buffer); | |
56 | + } | |
57 | + bufferIterator = buffer.begin(); | |
58 | + return bufferIterator != buffer.end(); | |
30 | 59 | } |
31 | 60 | } |
32 | 61 | |
... | ... |
morfeusz/ResultsIteratorImpl.hpp
... | ... | @@ -9,6 +9,7 @@ |
9 | 9 | #define RESULTSITERATORIMPL_HPP |
10 | 10 | |
11 | 11 | #include <string> |
12 | +#include <vector> | |
12 | 13 | |
13 | 14 | #include "morfeusz2.h" |
14 | 15 | //#include "MorfeuszInternal.hpp" |
... | ... | @@ -21,19 +22,28 @@ namespace morfeusz { |
21 | 22 | class ResultsIteratorImpl: public ResultsIterator { |
22 | 23 | public: |
23 | 24 | |
24 | - ResultsIteratorImpl(const MorfeuszInternal& morfeusz, const std::string& text); | |
25 | + ResultsIteratorImpl(const MorfeuszInternal& morfeusz, const char* text, const char* textEnd, bool isOwnerOfText); | |
25 | 26 | |
26 | - virtual ~ResultsIteratorImpl(); | |
27 | + ~ResultsIteratorImpl(); | |
27 | 28 | |
28 | - bool hasNext() const; | |
29 | + bool hasNext(); | |
29 | 30 | |
30 | - const MorphInterpretation& peek() const; | |
31 | + const MorphInterpretation& peek(); | |
31 | 32 | |
32 | 33 | MorphInterpretation next(); |
33 | 34 | |
34 | 35 | private: |
35 | 36 | const MorfeuszInternal& morfeusz; |
37 | + const char* text; | |
38 | + bool isOwnerOfText; | |
36 | 39 | TextReader reader; |
40 | + std::vector<MorphInterpretation> buffer; | |
41 | + std::vector<MorphInterpretation>::iterator bufferIterator; | |
42 | + | |
43 | + bool tryToReadIntoBuffer(); | |
44 | + | |
45 | + void ensureHasNext(); | |
46 | + | |
37 | 47 | }; |
38 | 48 | } |
39 | 49 | |
... | ... |
morfeusz/c_api/ResultsManager.cpp
... | ... | @@ -45,7 +45,6 @@ namespace morfeusz { |
45 | 45 | |
46 | 46 | InterpMorf ResultsManager::convertOneResult(const MorphInterpretation& res) { |
47 | 47 | InterpMorf convertedRes; |
48 | - cerr << res.toString(true) << endl; | |
49 | 48 | convertedRes.p = res.getStartNode(); |
50 | 49 | convertedRes.k = res.getEndNode(); |
51 | 50 | convertedRes.forma = const_cast<char*>(res.getOrth().c_str()); |
... | ... |
morfeusz/charset/TextReader.cpp
morfeusz/morfeusz2.h
... | ... | @@ -60,19 +60,18 @@ namespace morfeusz { |
60 | 60 | */ |
61 | 61 | IGNORE = 102 |
62 | 62 | }; |
63 | - | |
63 | + | |
64 | 64 | enum WhitespaceHandling { |
65 | - | |
66 | 65 | /** |
67 | 66 | * Ignore whitespaces |
68 | 67 | */ |
69 | 68 | SKIP = 301, |
70 | - | |
69 | + | |
71 | 70 | /** |
72 | 71 | * Append whitespaces to previous MorphInterpretation |
73 | 72 | */ |
74 | 73 | APPEND = 302, |
75 | - | |
74 | + | |
76 | 75 | /** |
77 | 76 | * Whitespaces are separate MorphInterpretation objects |
78 | 77 | */ |
... | ... | @@ -116,11 +115,23 @@ namespace morfeusz { |
116 | 115 | |
117 | 116 | /** |
118 | 117 | * Analyze given text and return the results as iterator. |
118 | + * Use this method for analysis of big texts. | |
119 | + * Copies the text under the hood - use analyze(const char*) if you want to avoid this. | |
119 | 120 | * |
120 | - * @param text - text for morphological analysis | |
121 | + * @param text - text for morphological analysis. | |
121 | 122 | * @return - iterator over morphological analysis results |
122 | 123 | */ |
123 | 124 | virtual ResultsIterator* analyze(const std::string& text) const = 0; |
125 | + | |
126 | + /** | |
127 | + * Analyze given text and return the results as iterator. | |
128 | + * Use this method for analysis of big texts. | |
129 | + * | |
130 | + * | |
131 | + * @param text - text for morphological analysis. This pointer must not be deleted before returned ResultsIterator object. | |
132 | + * @return - iterator over morphological analysis results | |
133 | + */ | |
134 | + virtual ResultsIterator* analyze(const char* text) const = 0; | |
124 | 135 | |
125 | 136 | /** |
126 | 137 | * Perform morphological analysis on a given text and put results in a vector. |
... | ... | @@ -182,7 +193,7 @@ namespace morfeusz { |
182 | 193 | * @param numbering |
183 | 194 | */ |
184 | 195 | virtual void setTokenNumbering(TokenNumbering numbering) = 0; |
185 | - | |
196 | + | |
186 | 197 | /** |
187 | 198 | * Set whitespace handling. |
188 | 199 | * |
... | ... | @@ -196,13 +207,13 @@ namespace morfeusz { |
196 | 207 | * @param debug |
197 | 208 | */ |
198 | 209 | virtual void setDebug(bool debug) = 0; |
199 | - | |
210 | + | |
200 | 211 | /** |
201 | 212 | * Gets default tagset used for morphological analysis. |
202 | 213 | * @return |
203 | 214 | */ |
204 | 215 | virtual const Tagset<std::string>& getDefaultAnalyzerTagset() const = 0; |
205 | - | |
216 | + | |
206 | 217 | /** |
207 | 218 | * Gets default tagset used for morphological synthesis. |
208 | 219 | * @return |
... | ... | @@ -212,19 +223,21 @@ namespace morfeusz { |
212 | 223 | |
213 | 224 | class ResultsIterator { |
214 | 225 | public: |
215 | - virtual bool hasNext() const = 0; | |
216 | - virtual const MorphInterpretation& peek() const = 0; | |
226 | + virtual bool hasNext() = 0; | |
227 | + virtual const MorphInterpretation& peek() = 0; | |
217 | 228 | virtual MorphInterpretation next() = 0; |
218 | - ~ResultsIterator() {} | |
229 | + | |
230 | + ~ResultsIterator() { | |
231 | + } | |
219 | 232 | }; |
220 | - | |
221 | - /** | |
233 | + | |
234 | + /** | |
222 | 235 | * Represents a tagset |
223 | 236 | */ |
224 | 237 | template <class T> |
225 | 238 | class Tagset { |
226 | 239 | public: |
227 | - | |
240 | + | |
228 | 241 | /** |
229 | 242 | * Returns tag (denoted by its index). |
230 | 243 | * |
... | ... | @@ -240,22 +253,23 @@ namespace morfeusz { |
240 | 253 | * @return - the named entity type |
241 | 254 | */ |
242 | 255 | virtual const T& getName(const int nameNum) const = 0; |
243 | - | |
256 | + | |
244 | 257 | /** |
245 | 258 | * Returs number of tags this tagset contains. |
246 | 259 | * |
247 | 260 | * @return |
248 | 261 | */ |
249 | 262 | virtual size_t getTagsSize() const = 0; |
250 | - | |
263 | + | |
251 | 264 | /** |
252 | 265 | * Returs number of named entity types this tagset contains. |
253 | 266 | * |
254 | 267 | * @return |
255 | 268 | */ |
256 | 269 | virtual size_t getNamesSize() const = 0; |
257 | - | |
258 | - virtual ~Tagset() {} | |
270 | + | |
271 | + virtual ~Tagset() { | |
272 | + } | |
259 | 273 | }; |
260 | 274 | |
261 | 275 | /** |
... | ... | @@ -277,10 +291,10 @@ namespace morfeusz { |
277 | 291 | |
278 | 292 | The structure below describes one edge of this DAG: |
279 | 293 | |
280 | - */ | |
294 | + */ | |
281 | 295 | class MorphInterpretation { |
282 | 296 | public: |
283 | - | |
297 | + | |
284 | 298 | /** |
285 | 299 | * |
286 | 300 | * @param startNode - number of start node in DAG. |
... | ... | @@ -301,14 +315,14 @@ namespace morfeusz { |
301 | 315 | int namenum, |
302 | 316 | const std::vector<std::string>* qualifiers, |
303 | 317 | const Tagset<std::string>* tagset); |
304 | - | |
318 | + | |
305 | 319 | MorphInterpretation(); |
306 | - | |
320 | + | |
307 | 321 | /** |
308 | 322 | * Creates new instance with "ign" tag (meaning: "not found in the dictionary") |
309 | 323 | */ |
310 | 324 | static MorphInterpretation createIgn(int startNode, int endNode, const std::string& orth, const Tagset<std::string>& tagset); |
311 | - | |
325 | + | |
312 | 326 | /** |
313 | 327 | * Creates new instance with "sp" tag (meaning: "this is a sequence of whitespaces") |
314 | 328 | */ |
... | ... | @@ -337,11 +351,11 @@ namespace morfeusz { |
337 | 351 | inline int getNamenum() const { |
338 | 352 | return namenum; |
339 | 353 | } |
340 | - | |
354 | + | |
341 | 355 | inline bool isIgn() const { |
342 | 356 | return tagnum == 0; |
343 | 357 | } |
344 | - | |
358 | + | |
345 | 359 | inline bool isWhitespace() const { |
346 | 360 | return tagnum == 1; |
347 | 361 | } |
... | ... |
morfeusz/test_runner.cpp
0 → 100644
1 | +/* | |
2 | + * File: test_results_iterator.cpp | |
3 | + * Author: lennyn | |
4 | + * | |
5 | + * Created on Jun 27, 2014, 11:44:49 AM | |
6 | + */ | |
7 | + | |
8 | +#include <cppunit/BriefTestProgressListener.h> | |
9 | +#include <cppunit/CompilerOutputter.h> | |
10 | +#include <cppunit/extensions/TestFactoryRegistry.h> | |
11 | +#include <cppunit/TestResult.h> | |
12 | +#include <cppunit/TestResultCollector.h> | |
13 | +#include <cppunit/TestRunner.h> | |
14 | + | |
15 | +#include "tests/TestCAPI.hpp" | |
16 | +#include "tests/TestMorfeusz.hpp" | |
17 | + | |
18 | +int main() { | |
19 | + CPPUNIT_NS::TestRunner runner; | |
20 | + CPPUNIT_NS::TestResult controller; | |
21 | + CPPUNIT_NS::TestResultCollector result; | |
22 | + controller.addListener(&result); | |
23 | + | |
24 | + runner.addTest(TestCAPI::suite()); | |
25 | + runner.addTest(TestMorfeusz::suite()); | |
26 | + | |
27 | + runner.run(controller); | |
28 | + | |
29 | + CPPUNIT_NS::CompilerOutputter outputter(&result, CPPUNIT_NS::stdCOut()); | |
30 | + outputter.write(); | |
31 | + return result.wasSuccessful() ? 0 : 1; | |
32 | +} | |
... | ... |
morfeusz/tests/TestCAPI.cpp
0 → 100644
1 | +/* | |
2 | + * File: TestCAPI.cpp | |
3 | + * Author: lennyn | |
4 | + * | |
5 | + * Created on Jun 27, 2014, 12:49:12 PM | |
6 | + */ | |
7 | + | |
8 | +#include "TestCAPI.hpp" | |
9 | +#include <string> | |
10 | +#include "morfeusz2_c.h" | |
11 | + | |
12 | +using namespace std; | |
13 | + | |
14 | + | |
15 | +CPPUNIT_TEST_SUITE_REGISTRATION(TestCAPI); | |
16 | + | |
17 | +TestCAPI::TestCAPI() { | |
18 | +} | |
19 | + | |
20 | +TestCAPI::~TestCAPI() { | |
21 | +} | |
22 | + | |
23 | +void TestCAPI::setUp() { | |
24 | +} | |
25 | + | |
26 | +void TestCAPI::tearDown() { | |
27 | +} | |
28 | + | |
29 | +void TestCAPI::testTwoSimpleInvocations() { | |
30 | + char* text = const_cast<char*> (string("AAaaBBbbCCcc DDDD.").c_str()); | |
31 | + InterpMorf* results = morfeusz_analyse(text); | |
32 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
33 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
34 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc"), string(results[0].forma)); | |
35 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc"), string(results[0].haslo)); | |
36 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[0].interp)); | |
37 | + | |
38 | + CPPUNIT_ASSERT_EQUAL(1, results[1].p); | |
39 | + CPPUNIT_ASSERT_EQUAL(2, results[1].k); | |
40 | + CPPUNIT_ASSERT_EQUAL(string("DDDD"), string(results[1].forma)); | |
41 | + CPPUNIT_ASSERT_EQUAL(string("DDDD"), string(results[1].haslo)); | |
42 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[1].interp)); | |
43 | + | |
44 | + CPPUNIT_ASSERT_EQUAL(2, results[2].p); | |
45 | + CPPUNIT_ASSERT_EQUAL(3, results[2].k); | |
46 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[2].forma)); | |
47 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[2].haslo)); | |
48 | + // CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[2].interp)); | |
49 | + CPPUNIT_ASSERT_EQUAL(-1, results[3].p); | |
50 | + | |
51 | + char* text1 = const_cast<char*> (string("EEeeFFff").c_str()); | |
52 | + results = morfeusz_analyse(text1); | |
53 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
54 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
55 | + CPPUNIT_ASSERT_EQUAL(string("EEeeFFff"), string(results[0].forma)); | |
56 | + CPPUNIT_ASSERT_EQUAL(string("EEeeFFff"), string(results[0].haslo)); | |
57 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[0].interp)); | |
58 | + | |
59 | + CPPUNIT_ASSERT_EQUAL(-1, results[1].p); | |
60 | +} | |
61 | + | |
62 | +void TestCAPI::testWhitespaceKEEP() { | |
63 | + | |
64 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_KEEP_WHITESPACE)); | |
65 | + | |
66 | + char* text = const_cast<char*> (string("AAaaBBbbCCcc .").c_str()); | |
67 | + InterpMorf* results = morfeusz_analyse(text); | |
68 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
69 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
70 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc"), string(results[0].forma)); | |
71 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc"), string(results[0].haslo)); | |
72 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[0].interp)); | |
73 | + | |
74 | + CPPUNIT_ASSERT_EQUAL(1, results[1].p); | |
75 | + CPPUNIT_ASSERT_EQUAL(2, results[1].k); | |
76 | + CPPUNIT_ASSERT_EQUAL(string(" "), string(results[1].forma)); | |
77 | + CPPUNIT_ASSERT_EQUAL(string(" "), string(results[1].haslo)); | |
78 | + // CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[2].interp)); | |
79 | + | |
80 | + CPPUNIT_ASSERT_EQUAL(2, results[2].p); | |
81 | + CPPUNIT_ASSERT_EQUAL(3, results[2].k); | |
82 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[2].forma)); | |
83 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[2].haslo)); | |
84 | + // CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[2].interp)); | |
85 | + | |
86 | + CPPUNIT_ASSERT_EQUAL(-1, results[3].p); | |
87 | +} | |
88 | + | |
89 | +void TestCAPI::testWhitespaceAPPEND() { | |
90 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_APPEND_WHITESPACE)); | |
91 | + | |
92 | + char* text = const_cast<char*> (string("AAaaBBbbCCcc .").c_str()); | |
93 | + InterpMorf* results = morfeusz_analyse(text); | |
94 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
95 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
96 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc "), string(results[0].forma)); | |
97 | + CPPUNIT_ASSERT_EQUAL(string("AAaaBBbbCCcc "), string(results[0].haslo)); | |
98 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[0].interp)); | |
99 | + | |
100 | + CPPUNIT_ASSERT_EQUAL(1, results[1].p); | |
101 | + CPPUNIT_ASSERT_EQUAL(2, results[1].k); | |
102 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[1].forma)); | |
103 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[1].haslo)); | |
104 | + // CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[2].interp)); | |
105 | + | |
106 | + CPPUNIT_ASSERT_EQUAL(-1, results[2].p); | |
107 | +} | |
108 | + | |
109 | +void TestCAPI::testEncodingUTF8() { | |
110 | + unsigned char text[] = {'z', 'a', /* ż */ 197, 188, /* ó */ 195, 179, '\0'}; | |
111 | + char* actualText = (char*) text; | |
112 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP1250)); | |
113 | + InterpMorf* results = morfeusz_analyse(actualText); | |
114 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
115 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
116 | + CPPUNIT_ASSERT_EQUAL(string(actualText), string(results[0].forma)); | |
117 | + CPPUNIT_ASSERT_EQUAL(string(actualText), string(results[0].haslo)); | |
118 | + CPPUNIT_ASSERT_EQUAL(string("ign"), string(results[0].interp)); | |
119 | + CPPUNIT_ASSERT_EQUAL(-1, results[2].p); | |
120 | +} | |
121 | + | |
122 | +void TestCAPI::testTokenNumberingCONTINUOUS() { | |
123 | + | |
124 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_SKIP_WHITESPACE)); | |
125 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_TOKEN_NUMBERING, MORFEUSZ_CONTINUOUS_TOKEN_NUMBERING)); | |
126 | + | |
127 | + InterpMorf* results = morfeusz_analyse(const_cast<char*>("aaaabbbb bbbbcccc.")); | |
128 | + CPPUNIT_ASSERT_EQUAL(0, results[0].p); | |
129 | + CPPUNIT_ASSERT_EQUAL(1, results[0].k); | |
130 | + CPPUNIT_ASSERT_EQUAL(string("aaaabbbb"), string(results[0].forma)); | |
131 | + | |
132 | + CPPUNIT_ASSERT_EQUAL(1, results[1].p); | |
133 | + CPPUNIT_ASSERT_EQUAL(2, results[1].k); | |
134 | + CPPUNIT_ASSERT_EQUAL(string("bbbbcccc"), string(results[1].forma)); | |
135 | + | |
136 | + CPPUNIT_ASSERT_EQUAL(2, results[2].p); | |
137 | + CPPUNIT_ASSERT_EQUAL(3, results[2].k); | |
138 | + CPPUNIT_ASSERT_EQUAL(string("."), string(results[2].forma)); | |
139 | + | |
140 | + CPPUNIT_ASSERT_EQUAL(-1, results[3].p); | |
141 | + | |
142 | + results = morfeusz_analyse(const_cast<char*>("ccccdddd")); | |
143 | + CPPUNIT_ASSERT_EQUAL(3, results[0].p); | |
144 | + CPPUNIT_ASSERT_EQUAL(4, results[0].k); | |
145 | + CPPUNIT_ASSERT_EQUAL(string("ccccdddd"), string(results[0].forma)); | |
146 | + | |
147 | + CPPUNIT_ASSERT_EQUAL(-1, results[1].p); | |
148 | +} | |
149 | + | |
150 | +void TestCAPI::testEncodingISO8859_2() { | |
151 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_ISO8859_2)); | |
152 | +} | |
153 | + | |
154 | +void TestCAPI::testEncodingCP1250() { | |
155 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP1250)); | |
156 | +} | |
157 | + | |
158 | +void TestCAPI::testEncodingCP852() { | |
159 | + CPPUNIT_ASSERT_EQUAL(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP852)); | |
160 | +} | |
161 | + | |
162 | +void TestCAPI::testWrongWhitespaceOption() { | |
163 | + CPPUNIT_ASSERT_EQUAL(0, morfeusz_set_option(MORFOPT_WHITESPACE, 666777)); | |
164 | +} | |
165 | + | |
166 | +void TestCAPI::testWrongEncodingOption() { | |
167 | + CPPUNIT_ASSERT_EQUAL(0, morfeusz_set_option(MORFOPT_ENCODING, 666777)); | |
168 | +} | |
169 | + | |
170 | +void TestCAPI::testWrongCaseOption() { | |
171 | + CPPUNIT_ASSERT_EQUAL(0, morfeusz_set_option(MORFOPT_CASE, 666777)); | |
172 | +} | |
173 | + | |
174 | +void TestCAPI::testWrongTokenNumberingOption() { | |
175 | + CPPUNIT_ASSERT_EQUAL(0, morfeusz_set_option(MORFOPT_TOKEN_NUMBERING, 666777)); | |
176 | +} | |
177 | + | |
... | ... |
morfeusz/tests/TestCAPI.hpp
0 → 100644
1 | +/* | |
2 | + * File: TestCAPI.hpp | |
3 | + * Author: lennyn | |
4 | + * | |
5 | + * Created on Jun 27, 2014, 12:49:12 PM | |
6 | + */ | |
7 | + | |
8 | +#ifndef TESTCAPI_HPP | |
9 | +#define TESTCAPI_HPP | |
10 | + | |
11 | +#include <cppunit/extensions/HelperMacros.h> | |
12 | + | |
13 | +class TestCAPI : public CPPUNIT_NS::TestFixture { | |
14 | + CPPUNIT_TEST_SUITE(TestCAPI); | |
15 | + | |
16 | + CPPUNIT_TEST(testTwoSimpleInvocations); | |
17 | + CPPUNIT_TEST(testWhitespaceKEEP); | |
18 | + CPPUNIT_TEST(testWhitespaceAPPEND); | |
19 | + CPPUNIT_TEST(testEncodingUTF8); | |
20 | + CPPUNIT_TEST(testEncodingISO8859_2); | |
21 | + CPPUNIT_TEST(testEncodingCP1250); | |
22 | + CPPUNIT_TEST(testEncodingCP852); | |
23 | + CPPUNIT_TEST(testWrongWhitespaceOption); | |
24 | + CPPUNIT_TEST(testWrongEncodingOption); | |
25 | + CPPUNIT_TEST(testWrongCaseOption); | |
26 | + CPPUNIT_TEST(testWrongTokenNumberingOption); | |
27 | + CPPUNIT_TEST(testTokenNumberingCONTINUOUS); | |
28 | + | |
29 | + CPPUNIT_TEST_SUITE_END(); | |
30 | + | |
31 | +public: | |
32 | + TestCAPI(); | |
33 | + virtual ~TestCAPI(); | |
34 | + void setUp(); | |
35 | + void tearDown(); | |
36 | + | |
37 | +private: | |
38 | + void testTwoSimpleInvocations(); | |
39 | + void testWhitespaceKEEP(); | |
40 | + void testWhitespaceAPPEND(); | |
41 | + void testEncodingUTF8(); | |
42 | + void testEncodingISO8859_2(); | |
43 | + void testEncodingCP1250(); | |
44 | + void testEncodingCP852(); | |
45 | + void testWrongWhitespaceOption(); | |
46 | + void testWrongEncodingOption(); | |
47 | + void testWrongCaseOption(); | |
48 | + void testWrongTokenNumberingOption(); | |
49 | + void testTokenNumberingCONTINUOUS(); | |
50 | +}; | |
51 | + | |
52 | +#endif /* TESTCAPI_HPP */ | |
53 | + | |
... | ... |
morfeusz/tests/TestMorfeusz.cpp
0 → 100644
1 | +/* | |
2 | + * File: TestMorfeusz.cpp | |
3 | + * Author: lennyn | |
4 | + * | |
5 | + * Created on Jun 27, 2014, 1:03:19 PM | |
6 | + */ | |
7 | + | |
8 | +#include "TestMorfeusz.hpp" | |
9 | + | |
10 | +#include <cstdio> | |
11 | +#include <vector> | |
12 | +#include <fstream> | |
13 | + | |
14 | +CPPUNIT_TEST_SUITE_REGISTRATION(TestMorfeusz); | |
15 | + | |
16 | +using namespace std; | |
17 | +using namespace morfeusz; | |
18 | + | |
19 | +TestMorfeusz::TestMorfeusz() { | |
20 | +} | |
21 | + | |
22 | +TestMorfeusz::~TestMorfeusz() { | |
23 | +} | |
24 | + | |
25 | +void TestMorfeusz::setUp() { | |
26 | + morfeusz = Morfeusz::createInstance(); | |
27 | +} | |
28 | + | |
29 | +void TestMorfeusz::tearDown() { | |
30 | + delete morfeusz; | |
31 | +} | |
32 | + | |
33 | +void TestMorfeusz::testAnalyzeIterate1() { | |
34 | + ResultsIterator* it = morfeusz->analyze("AAAAbbbbCCCC"); | |
35 | + CPPUNIT_ASSERT(it->hasNext()); | |
36 | + CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), it->peek().getOrth()); | |
37 | + CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), it->next().getOrth()); | |
38 | + CPPUNIT_ASSERT(!it->hasNext()); | |
39 | + CPPUNIT_ASSERT_THROW(it->peek(), MorfeuszException); | |
40 | + CPPUNIT_ASSERT_THROW(it->next(), MorfeuszException); | |
41 | + delete it; | |
42 | +} | |
43 | + | |
44 | +void TestMorfeusz::testAnalyzeVector1() { | |
45 | + vector<MorphInterpretation> res; | |
46 | + morfeusz->analyze("AAAAbbbbCCCC", res); | |
47 | + CPPUNIT_ASSERT_EQUAL((size_t) 1, res.size()); | |
48 | + CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), res[0].getOrth()); | |
49 | + CPPUNIT_ASSERT_EQUAL(string("AAAAbbbbCCCC"), res[0].getLemma()); | |
50 | +} | |
51 | + | |
52 | +static inline string prepareErrorneusTmpFile() { | |
53 | + char* filename = tmpnam(NULL); | |
54 | + ofstream out; | |
55 | + out.open(filename); | |
56 | + out << "asfasdfa" << endl; | |
57 | + out.close(); | |
58 | + return string(filename); | |
59 | +} | |
60 | + | |
61 | +void TestMorfeusz::testOpenInvalidFile() { | |
62 | + string filename(prepareErrorneusTmpFile()); | |
63 | + CPPUNIT_ASSERT_THROW(morfeusz->setAnalyzerDictionary(filename), FileFormatException); | |
64 | +} | |
65 | + | |
66 | +void TestMorfeusz::testOpenNonExistentFile() { | |
67 | + string filename(tmpnam(NULL)); | |
68 | + CPPUNIT_ASSERT_THROW(morfeusz->setAnalyzerDictionary(filename), std::ios_base::failure); | |
69 | +} | |
70 | + | |
71 | +void TestMorfeusz::testSetInvalidAgglOption() { | |
72 | + CPPUNIT_ASSERT_THROW(morfeusz->setAggl("asdfasdfa"), MorfeuszException); | |
73 | +} | |
74 | + | |
75 | +void TestMorfeusz::testSetInvalidPraetOption() { | |
76 | + CPPUNIT_ASSERT_THROW(morfeusz->setPraet("asdfasdfa"), MorfeuszException); | |
77 | +} | |
78 | + | |
79 | +void TestMorfeusz::testWhitespaceHandlingKEEP() { | |
80 | + | |
81 | +} | |
82 | + | |
83 | +void TestMorfeusz::testWhitespaceHandlingAPPEND() { | |
84 | + | |
85 | +} | |
... | ... |
morfeusz/tests/TestMorfeusz.hpp
0 → 100644
1 | +/* | |
2 | + * File: TestMorfeusz.hpp | |
3 | + * Author: lennyn | |
4 | + * | |
5 | + * Created on Jun 27, 2014, 1:03:19 PM | |
6 | + */ | |
7 | + | |
8 | +#ifndef TESTMORFEUSZ_HPP | |
9 | +#define TESTMORFEUSZ_HPP | |
10 | + | |
11 | +#include <cppunit/extensions/HelperMacros.h> | |
12 | + | |
13 | +#include "morfeusz2.h" | |
14 | + | |
15 | +class TestMorfeusz : public CPPUNIT_NS::TestFixture { | |
16 | + CPPUNIT_TEST_SUITE(TestMorfeusz); | |
17 | + | |
18 | + CPPUNIT_TEST(testAnalyzeIterate1); | |
19 | + CPPUNIT_TEST(testAnalyzeVector1); | |
20 | + CPPUNIT_TEST(testOpenInvalidFile); | |
21 | + CPPUNIT_TEST(testOpenNonExistentFile); | |
22 | + CPPUNIT_TEST(testSetInvalidAgglOption); | |
23 | + CPPUNIT_TEST(testSetInvalidPraetOption); | |
24 | + CPPUNIT_TEST(testWhitespaceHandlingKEEP); | |
25 | + CPPUNIT_TEST(testWhitespaceHandlingAPPEND); | |
26 | + | |
27 | + CPPUNIT_TEST_SUITE_END(); | |
28 | + | |
29 | +public: | |
30 | + TestMorfeusz(); | |
31 | + virtual ~TestMorfeusz(); | |
32 | + void setUp(); | |
33 | + void tearDown(); | |
34 | + | |
35 | +private: | |
36 | + void testAnalyzeIterate1(); | |
37 | + void testAnalyzeVector1(); | |
38 | + void testOpenInvalidFile(); | |
39 | + void testOpenNonExistentFile(); | |
40 | + void testSetInvalidAgglOption(); | |
41 | + void testSetInvalidPraetOption(); | |
42 | + void testWhitespaceHandlingKEEP(); | |
43 | + void testWhitespaceHandlingAPPEND(); | |
44 | + | |
45 | + morfeusz::Morfeusz* morfeusz; | |
46 | +}; | |
47 | + | |
48 | +#endif /* TESTMORFEUSZ_HPP */ | |
49 | + | |
... | ... |
morfeusz/tests/test_c_api.cpp deleted
1 | -/* | |
2 | - * File: test_c_api.cpp | |
3 | - * Author: lennyn | |
4 | - * | |
5 | - * Created on June 25, 2014, 7:43 PM | |
6 | - */ | |
7 | - | |
8 | -#include <cstdlib> | |
9 | -#include <string> | |
10 | -#include <iostream> | |
11 | -#include "morfeusz2_c.h" | |
12 | -#include "validate.hpp" | |
13 | - | |
14 | -using namespace std; | |
15 | - | |
16 | -void testTwoSimpleInvocations() { | |
17 | - char* text = const_cast<char*>(string("AAaaBBbbCCcc DDDD.").c_str()); | |
18 | - InterpMorf* results = morfeusz_analyse(text); | |
19 | - validateEquals(0, results[0].p); | |
20 | - validateEquals(1, results[0].k); | |
21 | - validateEquals(string("AAaaBBbbCCcc"), string(results[0].forma)); | |
22 | - validateEquals(string("AAaaBBbbCCcc"), string(results[0].haslo)); | |
23 | - validateEquals(string("ign"), string(results[0].interp)); | |
24 | - | |
25 | - validateEquals(1, results[1].p); | |
26 | - validateEquals(2, results[1].k); | |
27 | - validateEquals(string("DDDD"), string(results[1].forma)); | |
28 | - validateEquals(string("DDDD"), string(results[1].haslo)); | |
29 | - validateEquals(string("ign"), string(results[1].interp)); | |
30 | - | |
31 | - validateEquals(2, results[2].p); | |
32 | - validateEquals(3, results[2].k); | |
33 | - validateEquals(string("."), string(results[2].forma)); | |
34 | - validateEquals(string("."), string(results[2].haslo)); | |
35 | -// validateEquals(string("ign"), string(results[2].interp)); | |
36 | - validateEquals(-1, results[3].p); | |
37 | - | |
38 | - char* text1 = const_cast<char*>(string("EEeeFFff").c_str()); | |
39 | - results = morfeusz_analyse(text1); | |
40 | - validateEquals(0, results[0].p); | |
41 | - validateEquals(1, results[0].k); | |
42 | - validateEquals(string("EEeeFFff"), string(results[0].forma)); | |
43 | - validateEquals(string("EEeeFFff"), string(results[0].haslo)); | |
44 | - validateEquals(string("ign"), string(results[0].interp)); | |
45 | - | |
46 | - validateEquals(-1, results[1].p); | |
47 | -} | |
48 | - | |
49 | -void testWhitespaceKEEP() { | |
50 | - | |
51 | - validateEquals(1, morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_KEEP_WHITESPACE)); | |
52 | - | |
53 | - char* text = const_cast<char*>(string("AAaaBBbbCCcc .").c_str()); | |
54 | - InterpMorf* results = morfeusz_analyse(text); | |
55 | - validateEquals(0, results[0].p); | |
56 | - validateEquals(1, results[0].k); | |
57 | - validateEquals(string("AAaaBBbbCCcc"), string(results[0].forma)); | |
58 | - validateEquals(string("AAaaBBbbCCcc"), string(results[0].haslo)); | |
59 | - validateEquals(string("ign"), string(results[0].interp)); | |
60 | - | |
61 | - validateEquals(1, results[1].p); | |
62 | - validateEquals(2, results[1].k); | |
63 | - validateEquals(string(" "), string(results[1].forma)); | |
64 | - validateEquals(string(" "), string(results[1].haslo)); | |
65 | -// validateEquals(string("ign"), string(results[2].interp)); | |
66 | - | |
67 | - validateEquals(2, results[2].p); | |
68 | - validateEquals(3, results[2].k); | |
69 | - validateEquals(string("."), string(results[2].forma)); | |
70 | - validateEquals(string("."), string(results[2].haslo)); | |
71 | -// validateEquals(string("ign"), string(results[2].interp)); | |
72 | - | |
73 | - validateEquals(-1, results[3].p); | |
74 | -} | |
75 | - | |
76 | -void testWhitespaceAPPEND() { | |
77 | - validateEquals(1, morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_APPEND_WHITESPACE)); | |
78 | - | |
79 | - char* text = const_cast<char*>(string("AAaaBBbbCCcc .").c_str()); | |
80 | - InterpMorf* results = morfeusz_analyse(text); | |
81 | - validateEquals(0, results[0].p); | |
82 | - validateEquals(1, results[0].k); | |
83 | - validateEquals(string("AAaaBBbbCCcc "), string(results[0].forma)); | |
84 | - validateEquals(string("AAaaBBbbCCcc "), string(results[0].haslo)); | |
85 | - validateEquals(string("ign"), string(results[0].interp)); | |
86 | - | |
87 | - validateEquals(1, results[1].p); | |
88 | - validateEquals(2, results[1].k); | |
89 | - validateEquals(string("."), string(results[1].forma)); | |
90 | - validateEquals(string("."), string(results[1].haslo)); | |
91 | -// validateEquals(string("ign"), string(results[2].interp)); | |
92 | - | |
93 | - validateEquals(-1, results[2].p); | |
94 | -} | |
95 | - | |
96 | -void testEncodingUTF8() { | |
97 | - unsigned char text[] = {'z', 'a', /* ż */ 197, 188, /* ó */ 195, 179, '\0'}; | |
98 | - char* actualText = (char*) text; | |
99 | - validateEquals(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP1250)); | |
100 | - InterpMorf* results = morfeusz_analyse(actualText); | |
101 | - validateEquals(0, results[0].p); | |
102 | - validateEquals(1, results[0].k); | |
103 | - validateEquals(string(actualText), string(results[0].forma)); | |
104 | - validateEquals(string(actualText), string(results[0].haslo)); | |
105 | - validateEquals(string("ign"), string(results[0].interp)); | |
106 | - validateEquals(-1, results[2].p); | |
107 | -} | |
108 | - | |
109 | -void testTokenNumberingCONTINUOUS() { | |
110 | - | |
111 | - morfeusz_set_option(MORFOPT_WHITESPACE, MORFEUSZ_SKIP_WHITESPACE); | |
112 | - validateEquals(1, morfeusz_set_option(MORFOPT_TOKEN_NUMBERING, MORFEUSZ_CONTINUOUS_TOKEN_NUMBERING)); | |
113 | - | |
114 | - char* text = const_cast<char*>(string("a b.").c_str()); | |
115 | - InterpMorf* results = morfeusz_analyse(text); | |
116 | - validateEquals(0, results[0].p); | |
117 | - validateEquals(1, results[0].k); | |
118 | - validateEquals(string("a"), string(results[0].forma)); | |
119 | - | |
120 | - validateEquals(1, results[1].p); | |
121 | - validateEquals(2, results[1].k); | |
122 | - validateEquals(string("b"), string(results[1].forma)); | |
123 | - | |
124 | - validateEquals(2, results[2].p); | |
125 | - validateEquals(3, results[2].k); | |
126 | - validateEquals(string("."), string(results[2].forma)); | |
127 | - | |
128 | - validateEquals(-1, results[3].p); | |
129 | - | |
130 | - char* text1 = const_cast<char*>(string("c").c_str()); | |
131 | - results = morfeusz_analyse(text1); | |
132 | - validateEquals(3, results[0].p); | |
133 | - validateEquals(4, results[0].k); | |
134 | - validateEquals(string("c"), string(results[0].forma)); | |
135 | - | |
136 | - validateEquals(-1, results[1].p); | |
137 | -} | |
138 | - | |
139 | -void testEncodingISO8859_2() { | |
140 | - validateEquals(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_ISO8859_2)); | |
141 | -} | |
142 | - | |
143 | -void testEncodingCP1250() { | |
144 | - validateEquals(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP1250)); | |
145 | -} | |
146 | - | |
147 | -void testEncodingCP852() { | |
148 | - validateEquals(1, morfeusz_set_option(MORFOPT_ENCODING, MORFEUSZ_CP852)); | |
149 | -} | |
150 | - | |
151 | -void testWrongWhitespaceOption() { | |
152 | - validateEquals(0, morfeusz_set_option(MORFOPT_WHITESPACE, 666777)); | |
153 | -} | |
154 | - | |
155 | -void testWrongEncodingOption() { | |
156 | - validateEquals(0, morfeusz_set_option(MORFOPT_ENCODING, 666777)); | |
157 | -} | |
158 | - | |
159 | -void testWrongCaseOption() { | |
160 | - validateEquals(0, morfeusz_set_option(MORFOPT_CASE, 666777)); | |
161 | -} | |
162 | - | |
163 | -void testWrongTokenNumberingOption() { | |
164 | - validateEquals(0, morfeusz_set_option(MORFOPT_TOKEN_NUMBERING, 666777)); | |
165 | -} | |
166 | - | |
167 | -int main() { | |
168 | - testTwoSimpleInvocations(); | |
169 | - testWhitespaceKEEP(); | |
170 | - testWhitespaceAPPEND(); | |
171 | - testEncodingUTF8(); | |
172 | - testEncodingISO8859_2(); | |
173 | - testEncodingCP1250(); | |
174 | - testEncodingCP852(); | |
175 | - testWrongWhitespaceOption(); | |
176 | - testWrongEncodingOption(); | |
177 | - testWrongCaseOption(); | |
178 | - testWrongTokenNumberingOption(); | |
179 | - testTokenNumberingCONTINUOUS(); | |
180 | - return 0; | |
181 | -} | |
182 | - |
morfeusz/tests/validate.hpp deleted
1 | -/* | |
2 | - * File: validate.hpp | |
3 | - * Author: lennyn | |
4 | - * | |
5 | - * Created on June 25, 2014, 10:11 PM | |
6 | - */ | |
7 | - | |
8 | -#ifndef VALIDATE_HPP | |
9 | -#define VALIDATE_HPP | |
10 | - | |
11 | -#include <string> | |
12 | -#include <iostream> | |
13 | - | |
14 | -template <typename T> | |
15 | -inline void validateEquals(const T required, const T got) { | |
16 | - bool ok = required == got; | |
17 | - if (!ok) { | |
18 | - std::cerr << "ERROR: '" << required << "' != '" << got << "'" << std::endl; | |
19 | - throw "FAILED"; | |
20 | - } | |
21 | -} | |
22 | - | |
23 | -#endif /* VALIDATE_HPP */ | |
24 | - |
morfeusz/utils.hpp
... | ... | @@ -23,46 +23,51 @@ |
23 | 23 | |
24 | 24 | namespace morfeusz { |
25 | 25 | |
26 | -inline void validate(const bool cond, const std::string& msg) { | |
27 | - if (!cond) { | |
28 | - std::cerr << msg << std::endl; | |
29 | - throw msg; | |
26 | + inline void validate(const bool cond, const std::string& msg) { | |
27 | + if (!cond) { | |
28 | + std::cerr << msg << std::endl; | |
29 | + throw msg; | |
30 | + } | |
30 | 31 | } |
31 | -} | |
32 | 32 | |
33 | -inline std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { | |
34 | - std::stringstream ss(s); | |
35 | - std::string item; | |
36 | - while (std::getline(ss, item, delim)) { | |
37 | - elems.push_back(item); | |
33 | + inline std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems) { | |
34 | + std::stringstream ss(s); | |
35 | + std::string item; | |
36 | + while (std::getline(ss, item, delim)) { | |
37 | + elems.push_back(item); | |
38 | + } | |
39 | + return elems; | |
38 | 40 | } |
39 | - return elems; | |
40 | -} | |
41 | 41 | |
42 | -inline std::vector<std::string> split(const std::string &s, char delim) { | |
43 | - std::vector<std::string> elems; | |
44 | - split(s, delim, elems); | |
45 | - return elems; | |
46 | -} | |
42 | + inline std::vector<std::string> split(const std::string &s, char delim) { | |
43 | + std::vector<std::string> elems; | |
44 | + split(s, delim, elems); | |
45 | + return elems; | |
46 | + } | |
47 | 47 | |
48 | -//string &rtrim(string &s) { | |
49 | -// s.erase(find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(), s.end()); | |
50 | -// return s; | |
51 | -//} | |
48 | + //string &rtrim(string &s) { | |
49 | + // s.erase(find_if(s.rbegin(), s.rend(), not1(ptr_fun<int, int>(isspace))).base(), s.end()); | |
50 | + // return s; | |
51 | + //} | |
52 | 52 | |
53 | -template <class T> | |
54 | -inline T* readFile(const char* fname) { | |
55 | - std::ifstream ifs; | |
56 | - ifs.exceptions(std::ifstream::failbit | std::ifstream::badbit); | |
57 | - ifs.open(fname, std::ios::in | std::ios::binary | std::ios::ate); | |
58 | - // if (ifs.is_open()) { | |
59 | - long size = ifs.tellg(); | |
60 | - T* memblock = new T[size]; | |
61 | - ifs.seekg(0, std::ios::beg); | |
62 | - ifs.read(reinterpret_cast<char*> (memblock), size); | |
63 | - ifs.close(); | |
64 | - return memblock; | |
65 | -} | |
53 | + template <class T> | |
54 | + inline T* readFile(const char* fname) { | |
55 | + std::ifstream ifs; | |
56 | + ifs.open(fname, std::ios::in | std::ios::binary | std::ios::ate); | |
57 | + if (ifs.is_open()) { | |
58 | + long size = ifs.tellg(); | |
59 | + T* memblock = new T[size]; | |
60 | + ifs.seekg(0, std::ios::beg); | |
61 | + ifs.read(reinterpret_cast<char*> (memblock), size); | |
62 | + ifs.close(); | |
63 | + return memblock; | |
64 | + } | |
65 | + else { | |
66 | + std::stringstream ss; | |
67 | + ss << "Failed to open file: " << fname; | |
68 | + throw std::ios_base::failure(ss.str()); | |
69 | + } | |
70 | + } | |
66 | 71 | |
67 | 72 | } |
68 | 73 | |
... | ... |
morfeusz/wrappers/morfeusz.i
... | ... | @@ -56,6 +56,7 @@ namespace morfeusz { |
56 | 56 | |
57 | 57 | %ignore MorphInterpretation::createIgn(int startNode, int endNode, const std::string& orth, const Tagset<std::string>& tagset); |
58 | 58 | %ignore MorphInterpretation::createWhitespace(int startNode, int endNode, const std::string& orth, const Tagset<std::string>& tagset); |
59 | + %ignore Morfeusz::analyze(const char*) const; | |
59 | 60 | } |
60 | 61 | |
61 | 62 | // instantiate vector of interpretations |
... | ... |
morfeusz/wrappers/python/setup.py.in
... | ... | @@ -4,7 +4,7 @@ from setuptools import setup, Extension |
4 | 4 | morfeusz2 = Extension('_morfeusz2', |
5 | 5 | libraries=['morfeusz2'], |
6 | 6 | library_dirs=['${CMAKE_CURRENT_BINARY_DIR}/../..'], |
7 | - include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/../..'], | |
7 | + include_dirs=['${CMAKE_CURRENT_SOURCE_DIR}/../..', '${PROJECT_BINARY_DIR}'], | |
8 | 8 | sources=['${SWIG_PYTHON_OUTFILE_CXX}']) |
9 | 9 | |
10 | 10 | if __name__ == '__main__': |
... | ... |
nbproject/configurations.xml
... | ... | @@ -73,6 +73,7 @@ |
73 | 73 | <in>MorfeuszInternal.cpp</in> |
74 | 74 | <in>MorphInterpretation.cpp</in> |
75 | 75 | <in>Qualifiers.cpp</in> |
76 | + <in>ResultsIteratorImpl.cpp</in> | |
76 | 77 | <in>const.cpp</in> |
77 | 78 | <in>morfeusz2_c.cpp</in> |
78 | 79 | <in>morfeusz_analyzer.cpp</in> |
... | ... | @@ -106,12 +107,48 @@ |
106 | 107 | <logicalFolder name="TestFiles" |
107 | 108 | displayName="Test Files" |
108 | 109 | projectFiles="false" |
109 | - kind="TEST_LOGICAL_FOLDER"> | |
110 | + kind="TEST_LOGICAL_FOLDER" | |
111 | + root="morfeusz"> | |
110 | 112 | <logicalFolder name="f1" |
111 | 113 | displayName="New C++ Simple Test" |
112 | 114 | projectFiles="true" |
113 | 115 | kind="TEST"> |
114 | 116 | </logicalFolder> |
117 | + <logicalFolder name="f6" | |
118 | + displayName="New C++ Simple Test 1" | |
119 | + projectFiles="true" | |
120 | + kind="TEST"> | |
121 | + </logicalFolder> | |
122 | + <logicalFolder name="f9" | |
123 | + displayName="New C++ Simple Test 2" | |
124 | + projectFiles="true" | |
125 | + kind="TEST"> | |
126 | + </logicalFolder> | |
127 | + <logicalFolder name="f5" displayName="Test API" projectFiles="true" kind="TEST"> | |
128 | + </logicalFolder> | |
129 | + <logicalFolder name="f4" | |
130 | + displayName="Test C API" | |
131 | + projectFiles="true" | |
132 | + kind="TEST"> | |
133 | + </logicalFolder> | |
134 | + <logicalFolder name="f8" | |
135 | + displayName="Test Morfeusz class" | |
136 | + projectFiles="true" | |
137 | + kind="TEST"> | |
138 | + </logicalFolder> | |
139 | + <logicalFolder name="f2" | |
140 | + displayName="Test ResutsIteratorImpl" | |
141 | + projectFiles="true" | |
142 | + kind="TEST"> | |
143 | + </logicalFolder> | |
144 | + <logicalFolder name="f3" displayName="TestCAPI" projectFiles="true" kind="TEST"> | |
145 | + <itemPath>morfeusz/tests/.cpp</itemPath> | |
146 | + </logicalFolder> | |
147 | + <logicalFolder name="f7" | |
148 | + displayName="TestMorfeusz" | |
149 | + projectFiles="true" | |
150 | + kind="TEST"> | |
151 | + </logicalFolder> | |
115 | 152 | </logicalFolder> |
116 | 153 | </logicalFolder> |
117 | 154 | <sourceFolderFilter>^(nbproject)$</sourceFolderFilter> |
... | ... | @@ -128,9 +165,8 @@ |
128 | 165 | <rebuildPropChanged>false</rebuildPropChanged> |
129 | 166 | </toolsSet> |
130 | 167 | <flagsDictionary> |
131 | - <element flagsID="0" commonFlags="-std=c++98"/> | |
168 | + <element flagsID="0" commonFlags="-std=c++98 -O3"/> | |
132 | 169 | <element flagsID="1" commonFlags="-std=c++98 -O3 -fPIC"/> |
133 | - <element flagsID="2" commonFlags="-std=c++98 -fPIC"/> | |
134 | 170 | </flagsDictionary> |
135 | 171 | <codeAssistance> |
136 | 172 | </codeAssistance> |
... | ... | @@ -140,12 +176,6 @@ |
140 | 176 | <buildCommand>${MAKE} -f Makefile</buildCommand> |
141 | 177 | <cleanCommand>${MAKE} -f Makefile clean</cleanCommand> |
142 | 178 | <executablePath>build/morfeusz/morfeusz_analyzer</executablePath> |
143 | - <ccTool flags="1"> | |
144 | - <incDir> | |
145 | - <pElem>build</pElem> | |
146 | - <pElem>morfeusz</pElem> | |
147 | - </incDir> | |
148 | - </ccTool> | |
149 | 179 | </makeTool> |
150 | 180 | </makefileType> |
151 | 181 | <item path="build/default_fsa.cpp" ex="false" tool="1" flavor2="4"> |
... | ... | @@ -155,7 +185,6 @@ |
155 | 185 | <pElem>build/fsa</pElem> |
156 | 186 | </incDir> |
157 | 187 | <preprocessorList> |
158 | - <Elem>NDEBUG</Elem> | |
159 | 188 | <Elem>_OPTIMIZE__=1</Elem> |
160 | 189 | <Elem>__PIC__=2</Elem> |
161 | 190 | <Elem>__pic__=2</Elem> |
... | ... | @@ -174,7 +203,6 @@ |
174 | 203 | <pElem>build/fsa</pElem> |
175 | 204 | </incDir> |
176 | 205 | <preprocessorList> |
177 | - <Elem>NDEBUG</Elem> | |
178 | 206 | <Elem>_OPTIMIZE__=1</Elem> |
179 | 207 | <Elem>__PIC__=2</Elem> |
180 | 208 | <Elem>__pic__=2</Elem> |
... | ... | @@ -187,14 +215,14 @@ |
187 | 215 | </ccTool> |
188 | 216 | </item> |
189 | 217 | <item path="build/morfeusz/default_fsa.cpp" ex="false" tool="1" flavor2="4"> |
190 | - <ccTool flags="2"> | |
218 | + <ccTool flags="1"> | |
191 | 219 | </ccTool> |
192 | 220 | </item> |
193 | 221 | <item path="build/morfeusz/default_synth_fsa.cpp" |
194 | 222 | ex="false" |
195 | 223 | tool="1" |
196 | 224 | flavor2="4"> |
197 | - <ccTool flags="2"> | |
225 | + <ccTool flags="1"> | |
198 | 226 | </ccTool> |
199 | 227 | </item> |
200 | 228 | <item path="build/morfeusz/java/swigJAVA.cpp" ex="false" tool="1" flavor2="4"> |
... | ... | @@ -211,7 +239,6 @@ |
211 | 239 | <pElem>build/morfeusz/java</pElem> |
212 | 240 | </incDir> |
213 | 241 | <preprocessorList> |
214 | - <Elem>NDEBUG</Elem> | |
215 | 242 | <Elem>_OPTIMIZE__=1</Elem> |
216 | 243 | <Elem>__PIC__=2</Elem> |
217 | 244 | <Elem>__pic__=2</Elem> |
... | ... | @@ -236,7 +263,6 @@ |
236 | 263 | <pElem>build/morfeusz/perl</pElem> |
237 | 264 | </incDir> |
238 | 265 | <preprocessorList> |
239 | - <Elem>NDEBUG</Elem> | |
240 | 266 | <Elem>_OPTIMIZE__=1</Elem> |
241 | 267 | <Elem>morfeusz_perl_EXPORTS</Elem> |
242 | 268 | </preprocessorList> |
... | ... | @@ -257,7 +283,6 @@ |
257 | 283 | <pElem>build/morfeusz/python</pElem> |
258 | 284 | </incDir> |
259 | 285 | <preprocessorList> |
260 | - <Elem>NDEBUG</Elem> | |
261 | 286 | <Elem>_OPTIMIZE__=1</Elem> |
262 | 287 | <Elem>__PIC__=2</Elem> |
263 | 288 | <Elem>__pic__=2</Elem> |
... | ... | @@ -279,14 +304,14 @@ |
279 | 304 | ex="false" |
280 | 305 | tool="1" |
281 | 306 | flavor2="4"> |
282 | - <ccTool flags="2"> | |
307 | + <ccTool flags="1"> | |
283 | 308 | </ccTool> |
284 | 309 | </item> |
285 | 310 | <item path="build/morfeusz/wrappers/morfeuszPERL_wrap.cxx" |
286 | 311 | ex="false" |
287 | 312 | tool="1" |
288 | 313 | flavor2="4"> |
289 | - <ccTool flags="2"> | |
314 | + <ccTool flags="1"> | |
290 | 315 | <incDir> |
291 | 316 | <pElem>/usr/lib/perl/5.14/CORE</pElem> |
292 | 317 | <pElem>build/morfeusz/wrappers/perl</pElem> |
... | ... | @@ -306,7 +331,6 @@ |
306 | 331 | <pElem>morfeusz/build/morfeusz</pElem> |
307 | 332 | </incDir> |
308 | 333 | <preprocessorList> |
309 | - <Elem>NDEBUG</Elem> | |
310 | 334 | <Elem>_OPTIMIZE__=1</Elem> |
311 | 335 | </preprocessorList> |
312 | 336 | <undefinedList> |
... | ... | @@ -322,7 +346,6 @@ |
322 | 346 | <pElem>morfeusz/build/morfeusz</pElem> |
323 | 347 | </incDir> |
324 | 348 | <preprocessorList> |
325 | - <Elem>NDEBUG</Elem> | |
326 | 349 | <Elem>_OPTIMIZE__=1</Elem> |
327 | 350 | </preprocessorList> |
328 | 351 | <undefinedList> |
... | ... | @@ -330,64 +353,104 @@ |
330 | 353 | </undefinedList> |
331 | 354 | </ccTool> |
332 | 355 | </item> |
333 | - <folder path="0"> | |
356 | + <folder path="0/c_api"> | |
334 | 357 | <ccTool> |
335 | 358 | <incDir> |
359 | + <pElem>build</pElem> | |
360 | + <pElem>morfeusz</pElem> | |
336 | 361 | <pElem>build/morfeusz</pElem> |
337 | 362 | </incDir> |
338 | - </ccTool> | |
339 | - </folder> | |
340 | - <folder path="0/c_api"> | |
341 | - <ccTool> | |
342 | 363 | <preprocessorList> |
364 | + <Elem>NDEBUG</Elem> | |
343 | 365 | <Elem>libmorfeusz_EXPORTS</Elem> |
344 | 366 | </preprocessorList> |
345 | 367 | </ccTool> |
346 | 368 | </folder> |
347 | 369 | <folder path="0/case"> |
348 | 370 | <ccTool> |
371 | + <incDir> | |
372 | + <pElem>build</pElem> | |
373 | + <pElem>morfeusz</pElem> | |
374 | + <pElem>build/morfeusz</pElem> | |
375 | + </incDir> | |
349 | 376 | <preprocessorList> |
377 | + <Elem>NDEBUG</Elem> | |
350 | 378 | <Elem>libmorfeusz_EXPORTS</Elem> |
351 | 379 | </preprocessorList> |
352 | 380 | </ccTool> |
353 | 381 | </folder> |
354 | 382 | <folder path="0/charset"> |
355 | 383 | <ccTool> |
384 | + <incDir> | |
385 | + <pElem>build</pElem> | |
386 | + <pElem>morfeusz</pElem> | |
387 | + <pElem>build/morfeusz</pElem> | |
388 | + </incDir> | |
356 | 389 | <preprocessorList> |
390 | + <Elem>NDEBUG</Elem> | |
357 | 391 | <Elem>libmorfeusz_EXPORTS</Elem> |
358 | 392 | </preprocessorList> |
359 | 393 | </ccTool> |
360 | 394 | </folder> |
361 | 395 | <folder path="0/cli"> |
362 | 396 | <ccTool> |
397 | + <incDir> | |
398 | + <pElem>build</pElem> | |
399 | + <pElem>morfeusz</pElem> | |
400 | + <pElem>build/morfeusz</pElem> | |
401 | + </incDir> | |
363 | 402 | <preprocessorList> |
403 | + <Elem>NDEBUG</Elem> | |
364 | 404 | <Elem>libmorfeusz_EXPORTS</Elem> |
365 | 405 | </preprocessorList> |
366 | 406 | </ccTool> |
367 | 407 | </folder> |
368 | 408 | <folder path="0/deserialization"> |
369 | 409 | <ccTool> |
410 | + <incDir> | |
411 | + <pElem>build</pElem> | |
412 | + <pElem>morfeusz</pElem> | |
413 | + <pElem>build/morfeusz</pElem> | |
414 | + </incDir> | |
370 | 415 | <preprocessorList> |
416 | + <Elem>NDEBUG</Elem> | |
371 | 417 | <Elem>libmorfeusz_EXPORTS</Elem> |
372 | 418 | </preprocessorList> |
373 | 419 | </ccTool> |
374 | 420 | </folder> |
375 | 421 | <folder path="0/fsa"> |
376 | 422 | <ccTool> |
423 | + <incDir> | |
424 | + <pElem>build</pElem> | |
425 | + <pElem>morfeusz</pElem> | |
426 | + <pElem>build/morfeusz</pElem> | |
427 | + </incDir> | |
377 | 428 | <preprocessorList> |
429 | + <Elem>NDEBUG</Elem> | |
378 | 430 | <Elem>libmorfeusz_EXPORTS</Elem> |
379 | 431 | </preprocessorList> |
380 | 432 | </ccTool> |
381 | 433 | </folder> |
382 | 434 | <folder path="0/segrules"> |
383 | 435 | <ccTool> |
436 | + <incDir> | |
437 | + <pElem>build</pElem> | |
438 | + <pElem>morfeusz</pElem> | |
439 | + <pElem>build/morfeusz</pElem> | |
440 | + </incDir> | |
384 | 441 | <preprocessorList> |
442 | + <Elem>NDEBUG</Elem> | |
385 | 443 | <Elem>libmorfeusz_EXPORTS</Elem> |
386 | 444 | </preprocessorList> |
387 | 445 | </ccTool> |
388 | 446 | </folder> |
389 | 447 | <folder path="0/test"> |
390 | 448 | <ccTool> |
449 | + <incDir> | |
450 | + <pElem>build</pElem> | |
451 | + <pElem>morfeusz</pElem> | |
452 | + <pElem>build/morfeusz</pElem> | |
453 | + </incDir> | |
391 | 454 | <preprocessorList> |
392 | 455 | <Elem>NDEBUG</Elem> |
393 | 456 | <Elem>libmorfeusz_EXPORTS</Elem> |
... | ... | @@ -409,10 +472,135 @@ |
409 | 472 | <output>${TESTDIR}/TestFiles/f1</output> |
410 | 473 | </linkerTool> |
411 | 474 | </folder> |
475 | + <folder path="TestFiles/f2"> | |
476 | + <cTool> | |
477 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
478 | + </cTool> | |
479 | + <ccTool> | |
480 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
481 | + </ccTool> | |
482 | + <linkerTool> | |
483 | + <output>${TESTDIR}/TestFiles/f2</output> | |
484 | + <linkerLibItems> | |
485 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
486 | + </linkerLibItems> | |
487 | + </linkerTool> | |
488 | + </folder> | |
489 | + <folder path="TestFiles/f3"> | |
490 | + <cTool> | |
491 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
492 | + </cTool> | |
493 | + <ccTool> | |
494 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
495 | + </ccTool> | |
496 | + <linkerTool> | |
497 | + <output>${TESTDIR}/TestFiles/f3</output> | |
498 | + <linkerLibItems> | |
499 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
500 | + </linkerLibItems> | |
501 | + </linkerTool> | |
502 | + </folder> | |
503 | + <folder path="TestFiles/f4"> | |
504 | + <cTool> | |
505 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
506 | + </cTool> | |
507 | + <ccTool> | |
508 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
509 | + </ccTool> | |
510 | + <linkerTool> | |
511 | + <output>${TESTDIR}/TestFiles/f4</output> | |
512 | + <linkerLibItems> | |
513 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
514 | + </linkerLibItems> | |
515 | + </linkerTool> | |
516 | + </folder> | |
517 | + <folder path="TestFiles/f5"> | |
518 | + <cTool> | |
519 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
520 | + </cTool> | |
521 | + <ccTool> | |
522 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
523 | + </ccTool> | |
524 | + <linkerTool> | |
525 | + <output>${TESTDIR}/TestFiles/f5</output> | |
526 | + <linkerLibItems> | |
527 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
528 | + </linkerLibItems> | |
529 | + </linkerTool> | |
530 | + </folder> | |
531 | + <folder path="TestFiles/f6"> | |
532 | + <cTool> | |
533 | + <incDir> | |
534 | + <pElem>.</pElem> | |
535 | + </incDir> | |
536 | + </cTool> | |
537 | + <ccTool> | |
538 | + <incDir> | |
539 | + <pElem>.</pElem> | |
540 | + </incDir> | |
541 | + </ccTool> | |
542 | + <linkerTool> | |
543 | + <output>${TESTDIR}/TestFiles/f6</output> | |
544 | + </linkerTool> | |
545 | + </folder> | |
546 | + <folder path="TestFiles/f7"> | |
547 | + <cTool> | |
548 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
549 | + </cTool> | |
550 | + <ccTool> | |
551 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
552 | + </ccTool> | |
553 | + <linkerTool> | |
554 | + <output>${TESTDIR}/TestFiles/f7</output> | |
555 | + <linkerLibItems> | |
556 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
557 | + </linkerLibItems> | |
558 | + </linkerTool> | |
559 | + </folder> | |
560 | + <folder path="TestFiles/f8"> | |
561 | + <cTool> | |
562 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
563 | + </cTool> | |
564 | + <ccTool> | |
565 | + <commandLine>`cppunit-config --cflags`</commandLine> | |
566 | + </ccTool> | |
567 | + <linkerTool> | |
568 | + <output>${TESTDIR}/TestFiles/f8</output> | |
569 | + <linkerLibItems> | |
570 | + <linkerOptionItem>`cppunit-config --libs`</linkerOptionItem> | |
571 | + </linkerLibItems> | |
572 | + </linkerTool> | |
573 | + </folder> | |
574 | + <folder path="TestFiles/f9"> | |
575 | + <cTool> | |
576 | + <incDir> | |
577 | + <pElem>.</pElem> | |
578 | + </incDir> | |
579 | + </cTool> | |
580 | + <ccTool> | |
581 | + <incDir> | |
582 | + <pElem>.</pElem> | |
583 | + </incDir> | |
584 | + </ccTool> | |
585 | + <linkerTool> | |
586 | + <output>${TESTDIR}/TestFiles/f9</output> | |
587 | + </linkerTool> | |
588 | + </folder> | |
589 | + <folder path="build"> | |
590 | + <ccTool> | |
591 | + <incDir> | |
592 | + <pElem>build</pElem> | |
593 | + <pElem>morfeusz</pElem> | |
594 | + </incDir> | |
595 | + <preprocessorList> | |
596 | + <Elem>NDEBUG</Elem> | |
597 | + </preprocessorList> | |
598 | + </ccTool> | |
599 | + </folder> | |
412 | 600 | <folder path="build/morfeusz/wrappers/java"> |
413 | 601 | <ccTool> |
414 | 602 | <incDir> |
415 | - <pElem>/usr/lib/jvm/default-java/include</pElem> | |
603 | + <pElem>/usr/lib/jvm/java-6-openjdk/include</pElem> | |
416 | 604 | </incDir> |
417 | 605 | <preprocessorList> |
418 | 606 | <Elem>libjmorfeusz_EXPORTS</Elem> |
... | ... | @@ -422,6 +610,8 @@ |
422 | 610 | <folder path="java"> |
423 | 611 | <ccTool> |
424 | 612 | <incDir> |
613 | + <pElem>build</pElem> | |
614 | + <pElem>morfeusz</pElem> | |
425 | 615 | <pElem>build/morfeusz</pElem> |
426 | 616 | <pElem>build/fsa</pElem> |
427 | 617 | <pElem>build1</pElem> |
... | ... | @@ -440,7 +630,12 @@ |
440 | 630 | </folder> |
441 | 631 | <folder path="morfeusz"> |
442 | 632 | <ccTool> |
633 | + <incDir> | |
634 | + <pElem>build</pElem> | |
635 | + <pElem>morfeusz</pElem> | |
636 | + </incDir> | |
443 | 637 | <preprocessorList> |
638 | + <Elem>NDEBUG</Elem> | |
444 | 639 | <Elem>libmorfeusz_EXPORTS</Elem> |
445 | 640 | </preprocessorList> |
446 | 641 | </ccTool> |
... | ... | @@ -453,7 +648,6 @@ |
453 | 648 | <pElem>/usr/lib/jvm/default-java/include</pElem> |
454 | 649 | </incDir> |
455 | 650 | <preprocessorList> |
456 | - <Elem>NDEBUG</Elem> | |
457 | 651 | <Elem>_OPTIMIZE__=1</Elem> |
458 | 652 | <Elem>libjmorfeusz_EXPORTS</Elem> |
459 | 653 | </preprocessorList> |
... | ... | @@ -470,110 +664,159 @@ |
470 | 664 | </ccTool> |
471 | 665 | </folder> |
472 | 666 | <item path="morfeusz/DefaultTagset.cpp" ex="false" tool="1" flavor2="4"> |
473 | - <ccTool flags="2"> | |
667 | + <ccTool flags="1"> | |
668 | + <incDir> | |
669 | + <pElem>build</pElem> | |
670 | + <pElem>morfeusz</pElem> | |
671 | + <pElem>build/morfeusz</pElem> | |
672 | + </incDir> | |
474 | 673 | <preprocessorList> |
674 | + <Elem>NDEBUG</Elem> | |
475 | 675 | <Elem>libmorfeusz_EXPORTS</Elem> |
476 | 676 | </preprocessorList> |
477 | 677 | </ccTool> |
478 | 678 | </item> |
479 | 679 | <item path="morfeusz/Environment.cpp" ex="false" tool="1" flavor2="4"> |
480 | - <ccTool flags="2"> | |
680 | + <ccTool flags="1"> | |
681 | + <incDir> | |
682 | + <pElem>build</pElem> | |
683 | + <pElem>morfeusz</pElem> | |
684 | + <pElem>build/morfeusz</pElem> | |
685 | + </incDir> | |
481 | 686 | <preprocessorList> |
687 | + <Elem>NDEBUG</Elem> | |
482 | 688 | <Elem>libmorfeusz_EXPORTS</Elem> |
483 | 689 | </preprocessorList> |
484 | 690 | </ccTool> |
485 | 691 | </item> |
486 | 692 | <item path="morfeusz/InflexionGraph.cpp" ex="false" tool="1" flavor2="4"> |
487 | - <ccTool flags="2"> | |
693 | + <ccTool flags="1"> | |
694 | + <incDir> | |
695 | + <pElem>build</pElem> | |
696 | + <pElem>morfeusz</pElem> | |
697 | + <pElem>build/morfeusz</pElem> | |
698 | + </incDir> | |
488 | 699 | <preprocessorList> |
700 | + <Elem>NDEBUG</Elem> | |
489 | 701 | <Elem>libmorfeusz_EXPORTS</Elem> |
490 | 702 | </preprocessorList> |
491 | 703 | </ccTool> |
492 | 704 | </item> |
493 | 705 | <item path="morfeusz/Morfeusz.cpp" ex="false" tool="1" flavor2="4"> |
494 | - <ccTool flags="2"> | |
706 | + <ccTool flags="1"> | |
707 | + <incDir> | |
708 | + <pElem>build</pElem> | |
709 | + <pElem>morfeusz</pElem> | |
710 | + <pElem>build/morfeusz</pElem> | |
711 | + </incDir> | |
495 | 712 | <preprocessorList> |
713 | + <Elem>NDEBUG</Elem> | |
496 | 714 | <Elem>libmorfeusz_EXPORTS</Elem> |
497 | 715 | </preprocessorList> |
498 | 716 | </ccTool> |
499 | 717 | </item> |
500 | 718 | <item path="morfeusz/MorfeuszInternal.cpp" ex="false" tool="1" flavor2="4"> |
501 | - <ccTool flags="2"> | |
719 | + <ccTool flags="1"> | |
720 | + <incDir> | |
721 | + <pElem>build</pElem> | |
722 | + <pElem>morfeusz</pElem> | |
723 | + <pElem>build/morfeusz</pElem> | |
724 | + </incDir> | |
502 | 725 | <preprocessorList> |
726 | + <Elem>NDEBUG</Elem> | |
503 | 727 | <Elem>libmorfeusz_EXPORTS</Elem> |
504 | 728 | </preprocessorList> |
505 | 729 | </ccTool> |
506 | 730 | </item> |
507 | 731 | <item path="morfeusz/MorphInterpretation.cpp" ex="false" tool="1" flavor2="4"> |
508 | - <ccTool flags="2"> | |
732 | + <ccTool flags="1"> | |
733 | + <incDir> | |
734 | + <pElem>build</pElem> | |
735 | + <pElem>morfeusz</pElem> | |
736 | + <pElem>build/morfeusz</pElem> | |
737 | + </incDir> | |
509 | 738 | <preprocessorList> |
739 | + <Elem>NDEBUG</Elem> | |
510 | 740 | <Elem>libmorfeusz_EXPORTS</Elem> |
511 | 741 | </preprocessorList> |
512 | 742 | </ccTool> |
513 | 743 | </item> |
514 | 744 | <item path="morfeusz/Qualifiers.cpp" ex="false" tool="1" flavor2="4"> |
515 | - <ccTool flags="2"> | |
745 | + <ccTool flags="1"> | |
746 | + <incDir> | |
747 | + <pElem>build</pElem> | |
748 | + <pElem>morfeusz</pElem> | |
749 | + <pElem>build/morfeusz</pElem> | |
750 | + </incDir> | |
516 | 751 | <preprocessorList> |
752 | + <Elem>NDEBUG</Elem> | |
517 | 753 | <Elem>libmorfeusz_EXPORTS</Elem> |
518 | 754 | </preprocessorList> |
519 | 755 | </ccTool> |
520 | 756 | </item> |
521 | 757 | <item path="morfeusz/ResultsIteratorImpl.cpp" ex="false" tool="1" flavor2="4"> |
522 | - <ccTool flags="2"> | |
758 | + <ccTool flags="1"> | |
523 | 759 | <incDir> |
524 | 760 | <pElem>build</pElem> |
525 | 761 | <pElem>morfeusz</pElem> |
526 | 762 | <pElem>build/morfeusz</pElem> |
527 | 763 | </incDir> |
528 | 764 | <preprocessorList> |
765 | + <Elem>NDEBUG</Elem> | |
529 | 766 | <Elem>libmorfeusz_EXPORTS</Elem> |
530 | 767 | </preprocessorList> |
531 | 768 | </ccTool> |
532 | 769 | </item> |
533 | 770 | <item path="morfeusz/c_api/ResultsManager.cpp" ex="false" tool="1" flavor2="4"> |
534 | - <ccTool flags="2"> | |
771 | + <ccTool flags="1"> | |
535 | 772 | </ccTool> |
536 | 773 | </item> |
537 | 774 | <item path="morfeusz/case/CaseConverter.cpp" ex="false" tool="1" flavor2="4"> |
538 | - <ccTool flags="2"> | |
775 | + <ccTool flags="1"> | |
539 | 776 | </ccTool> |
540 | 777 | </item> |
541 | 778 | <item path="morfeusz/case/CasePatternHelper.cpp" |
542 | 779 | ex="false" |
543 | 780 | tool="1" |
544 | 781 | flavor2="4"> |
545 | - <ccTool flags="2"> | |
782 | + <ccTool flags="1"> | |
546 | 783 | </ccTool> |
547 | 784 | </item> |
548 | 785 | <item path="morfeusz/case/caseconv.cpp" ex="false" tool="1" flavor2="4"> |
549 | - <ccTool flags="2"> | |
786 | + <ccTool flags="1"> | |
550 | 787 | </ccTool> |
551 | 788 | </item> |
552 | 789 | <item path="morfeusz/charset/CharsetConverter.cpp" |
553 | 790 | ex="false" |
554 | 791 | tool="1" |
555 | 792 | flavor2="4"> |
556 | - <ccTool flags="2"> | |
793 | + <ccTool flags="1"> | |
557 | 794 | </ccTool> |
558 | 795 | </item> |
559 | 796 | <item path="morfeusz/charset/TextReader.cpp" ex="false" tool="1" flavor2="4"> |
560 | - <ccTool flags="2"> | |
797 | + <ccTool flags="1"> | |
561 | 798 | </ccTool> |
562 | 799 | </item> |
563 | 800 | <item path="morfeusz/charset/conversion_tables.cpp" |
564 | 801 | ex="false" |
565 | 802 | tool="1" |
566 | 803 | flavor2="4"> |
567 | - <ccTool flags="2"> | |
804 | + <ccTool flags="1"> | |
568 | 805 | </ccTool> |
569 | 806 | </item> |
570 | 807 | <item path="morfeusz/cli/cli.cpp" ex="false" tool="1" flavor2="4"> |
571 | - <ccTool flags="2"> | |
808 | + <ccTool flags="1"> | |
572 | 809 | </ccTool> |
573 | 810 | </item> |
574 | 811 | <item path="morfeusz/const.cpp" ex="false" tool="1" flavor2="4"> |
575 | - <ccTool flags="2"> | |
812 | + <ccTool flags="1"> | |
813 | + <incDir> | |
814 | + <pElem>build</pElem> | |
815 | + <pElem>morfeusz</pElem> | |
816 | + <pElem>build/morfeusz</pElem> | |
817 | + </incDir> | |
576 | 818 | <preprocessorList> |
819 | + <Elem>NDEBUG</Elem> | |
577 | 820 | <Elem>libmorfeusz_EXPORTS</Elem> |
578 | 821 | </preprocessorList> |
579 | 822 | </ccTool> |
... | ... | @@ -582,62 +825,84 @@ |
582 | 825 | ex="false" |
583 | 826 | tool="1" |
584 | 827 | flavor2="4"> |
585 | - <ccTool flags="2"> | |
828 | + <ccTool flags="1"> | |
586 | 829 | </ccTool> |
587 | 830 | </item> |
588 | 831 | <item path="morfeusz/deserialization/MorphDeserializer.cpp" |
589 | 832 | ex="false" |
590 | 833 | tool="1" |
591 | 834 | flavor2="4"> |
592 | - <ccTool flags="2"> | |
835 | + <ccTool flags="1"> | |
593 | 836 | </ccTool> |
594 | 837 | </item> |
595 | 838 | <item path="morfeusz/deserialization/morphInterps/InterpretedChunksDecoder.cpp" |
596 | 839 | ex="false" |
597 | 840 | tool="1" |
598 | 841 | flavor2="4"> |
599 | - <ccTool flags="2"> | |
842 | + <ccTool flags="1"> | |
600 | 843 | </ccTool> |
601 | 844 | </item> |
602 | 845 | <item path="morfeusz/deserialization/morphInterps/InterpretedChunksDecoder4Analyzer.cpp" |
603 | 846 | ex="false" |
604 | 847 | tool="1" |
605 | 848 | flavor2="4"> |
606 | - <ccTool flags="2"> | |
849 | + <ccTool flags="1"> | |
607 | 850 | </ccTool> |
608 | 851 | </item> |
609 | 852 | <item path="morfeusz/deserialization/morphInterps/InterpretedChunksDecoder4Generator.cpp" |
610 | 853 | ex="false" |
611 | 854 | tool="1" |
612 | 855 | flavor2="4"> |
613 | - <ccTool flags="2"> | |
856 | + <ccTool flags="1"> | |
614 | 857 | </ccTool> |
615 | 858 | </item> |
616 | 859 | <item path="morfeusz/fsa/const.cpp" ex="false" tool="1" flavor2="4"> |
617 | - <ccTool flags="2"> | |
860 | + <ccTool flags="1"> | |
618 | 861 | </ccTool> |
619 | 862 | </item> |
620 | 863 | <item path="morfeusz/morfeusz2_c.cpp" ex="false" tool="1" flavor2="4"> |
621 | - <ccTool flags="2"> | |
864 | + <ccTool flags="1"> | |
865 | + <incDir> | |
866 | + <pElem>build</pElem> | |
867 | + <pElem>morfeusz</pElem> | |
868 | + <pElem>build/morfeusz</pElem> | |
869 | + </incDir> | |
622 | 870 | <preprocessorList> |
871 | + <Elem>NDEBUG</Elem> | |
623 | 872 | <Elem>libmorfeusz_EXPORTS</Elem> |
624 | 873 | </preprocessorList> |
625 | 874 | </ccTool> |
626 | 875 | </item> |
627 | 876 | <item path="morfeusz/morfeusz_analyzer.cpp" ex="false" tool="1" flavor2="4"> |
628 | 877 | <ccTool flags="0"> |
878 | + <incDir> | |
879 | + <pElem>build</pElem> | |
880 | + <pElem>morfeusz</pElem> | |
881 | + <pElem>build/morfeusz</pElem> | |
882 | + </incDir> | |
883 | + <preprocessorList> | |
884 | + <Elem>NDEBUG</Elem> | |
885 | + </preprocessorList> | |
629 | 886 | </ccTool> |
630 | 887 | </item> |
631 | 888 | <item path="morfeusz/morfeusz_generator.cpp" ex="false" tool="1" flavor2="4"> |
632 | 889 | <ccTool flags="0"> |
890 | + <incDir> | |
891 | + <pElem>build</pElem> | |
892 | + <pElem>morfeusz</pElem> | |
893 | + <pElem>build/morfeusz</pElem> | |
894 | + </incDir> | |
895 | + <preprocessorList> | |
896 | + <Elem>NDEBUG</Elem> | |
897 | + </preprocessorList> | |
633 | 898 | </ccTool> |
634 | 899 | </item> |
635 | 900 | <item path="morfeusz/segrules/SegrulesFSA.cpp" ex="false" tool="1" flavor2="4"> |
636 | - <ccTool flags="2"> | |
901 | + <ccTool flags="1"> | |
637 | 902 | </ccTool> |
638 | 903 | </item> |
639 | 904 | <item path="morfeusz/segrules/segrules.cpp" ex="false" tool="1" flavor2="4"> |
640 | - <ccTool flags="2"> | |
905 | + <ccTool flags="1"> | |
641 | 906 | </ccTool> |
642 | 907 | </item> |
643 | 908 | <item path="morfeusz/test/test_recognize_dict.cpp" |
... | ... | @@ -650,7 +915,45 @@ |
650 | 915 | tool="1" |
651 | 916 | flavor2="4"> |
652 | 917 | </item> |
653 | - <item path="morfeusz/tests/test_c_api.cpp" ex="false" tool="1" flavor2="4"> | |
918 | + <item path="morfeusz/test_runner.cpp" ex="false" tool="1" flavor2="4"> | |
919 | + <ccTool flags="0"> | |
920 | + <incDir> | |
921 | + <pElem>build</pElem> | |
922 | + <pElem>morfeusz</pElem> | |
923 | + <pElem>build/morfeusz</pElem> | |
924 | + </incDir> | |
925 | + <preprocessorList> | |
926 | + <Elem>NDEBUG</Elem> | |
927 | + </preprocessorList> | |
928 | + </ccTool> | |
929 | + </item> | |
930 | + <item path="morfeusz/tests/.cpp" ex="true" tool="3" flavor2="0"> | |
931 | + </item> | |
932 | + <item path="morfeusz/tests/TestCAPI.cpp" ex="false" tool="1" flavor2="4"> | |
933 | + <ccTool flags="0"> | |
934 | + <incDir> | |
935 | + <pElem>build</pElem> | |
936 | + <pElem>morfeusz</pElem> | |
937 | + <pElem>build/morfeusz</pElem> | |
938 | + </incDir> | |
939 | + <preprocessorList> | |
940 | + <Elem>NDEBUG</Elem> | |
941 | + </preprocessorList> | |
942 | + </ccTool> | |
943 | + </item> | |
944 | + <item path="morfeusz/tests/TestMorfeusz.cpp" ex="false" tool="1" flavor2="4"> | |
945 | + <ccTool flags="0"> | |
946 | + <incDir> | |
947 | + <pElem>build</pElem> | |
948 | + <pElem>morfeusz</pElem> | |
949 | + <pElem>build/morfeusz</pElem> | |
950 | + </incDir> | |
951 | + <preprocessorList> | |
952 | + <Elem>NDEBUG</Elem> | |
953 | + </preprocessorList> | |
954 | + </ccTool> | |
955 | + </item> | |
956 | + <item path="morfeusz/tests/test_c_api.cpp" ex="false" tool="1" flavor2="0"> | |
654 | 957 | </item> |
655 | 958 | </conf> |
656 | 959 | </confs> |
... | ... |