diff --git a/alib2algo/test-src/stringology/exact/stringMatchTest.cpp b/alib2algo/test-src/stringology/exact/stringMatchTest.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d3d275373aa280d2e05db6f9492615993925095d --- /dev/null +++ b/alib2algo/test-src/stringology/exact/stringMatchTest.cpp @@ -0,0 +1,24 @@ +#include <list> +#include "stringMatchTest.h" + +#include <string/LinearString.h> +#include <stringology/exact/ExactFactorMatch.h> + +#define CPPUNIT_IMPLY(x, y) CPPUNIT_ASSERT(!(x) || (y)) + +CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( stringMatchTest, "string" ); +CPPUNIT_TEST_SUITE_REGISTRATION( stringMatchTest ); + +void stringMatchTest::setUp() { +} + +void stringMatchTest::tearDown() { +} + +void stringMatchTest::testStringMatch() { + string::LinearString < > linear1({alphabet::symbolFrom(0), alphabet::symbolFrom(1), alphabet::symbolFrom(2), alphabet::symbolFrom(3)}); + string::LinearString < > linear2({alphabet::symbolFrom(1), alphabet::symbolFrom(2), alphabet::symbolFrom(3)}); + + CPPUNIT_ASSERT ( stringology::exact::ExactFactorMatch::match ( linear1, linear2 ).count ( 1 ) ); +} + diff --git a/alib2algo/test-src/stringology/exact/stringMatchTest.h b/alib2algo/test-src/stringology/exact/stringMatchTest.h new file mode 100644 index 0000000000000000000000000000000000000000..6af90ab70b9c7d3a6354bc1149967d5e54e143a8 --- /dev/null +++ b/alib2algo/test-src/stringology/exact/stringMatchTest.h @@ -0,0 +1,19 @@ +#ifndef STRING_MATCH_TEST_H_ +#define STRING_MATCH_TEST_H_ + +#include <cppunit/extensions/HelperMacros.h> + +class stringMatchTest : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE( stringMatchTest ); + CPPUNIT_TEST( testStringMatch ); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp(); + void tearDown(); + + void testStringMatch(); +}; + +#endif // STRING_MATCH_TEST_H_