From 874959329442dafecbfbab109353bcbdc469a7a7 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 6 Dec 2016 09:42:24 +0100 Subject: [PATCH] add string match tests --- .../stringology/exact/stringMatchTest.cpp | 24 +++++++++++++++++++ .../stringology/exact/stringMatchTest.h | 19 +++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 alib2algo/test-src/stringology/exact/stringMatchTest.cpp create mode 100644 alib2algo/test-src/stringology/exact/stringMatchTest.h diff --git a/alib2algo/test-src/stringology/exact/stringMatchTest.cpp b/alib2algo/test-src/stringology/exact/stringMatchTest.cpp new file mode 100644 index 0000000000..d3d275373a --- /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 0000000000..6af90ab70b --- /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_ -- GitLab