Test test utilities not used anyways
This commit is contained in:
parent
61edf58c3e
commit
929c817c08
|
@ -0,0 +1 @@
|
||||||
|
some file
|
|
@ -1,23 +1,34 @@
|
||||||
#include "../misc/levenshtein.h"
|
#include "../misc/levenshtein.h"
|
||||||
#include "../misc/multiarray.h"
|
#include "../misc/multiarray.h"
|
||||||
|
|
||||||
|
#include "../conversion/stringbuilder.h"
|
||||||
|
|
||||||
|
#include "../io/misc.h"
|
||||||
|
|
||||||
#include "../tests/testutils.h"
|
#include "../tests/testutils.h"
|
||||||
|
|
||||||
#include <cppunit/TestFixture.h>
|
#include <cppunit/TestFixture.h>
|
||||||
#include <cppunit/extensions/HelperMacros.h>
|
#include <cppunit/extensions/HelperMacros.h>
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
using namespace ConversionUtilities;
|
||||||
|
using namespace IoUtilities;
|
||||||
using namespace MiscUtilities;
|
using namespace MiscUtilities;
|
||||||
|
using namespace TestUtilities;
|
||||||
using namespace TestUtilities::Literals;
|
using namespace TestUtilities::Literals;
|
||||||
|
|
||||||
using namespace CPPUNIT_NS;
|
using namespace CPPUNIT_NS;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief The MiscTests class tests functions and classes from the misc directory.
|
* \brief The MiscTests class tests misc functions and classes (mainly of files contained by the misc directory).
|
||||||
*/
|
*/
|
||||||
class MiscTests : public TestFixture {
|
class MiscTests : public TestFixture {
|
||||||
CPPUNIT_TEST_SUITE(MiscTests);
|
CPPUNIT_TEST_SUITE(MiscTests);
|
||||||
CPPUNIT_TEST(testMultiArray);
|
CPPUNIT_TEST(testMultiArray);
|
||||||
CPPUNIT_TEST(testLevenshtein);
|
CPPUNIT_TEST(testLevenshtein);
|
||||||
|
CPPUNIT_TEST(testTestUtilities);
|
||||||
CPPUNIT_TEST_SUITE_END();
|
CPPUNIT_TEST_SUITE_END();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -30,6 +41,7 @@ public:
|
||||||
|
|
||||||
void testMultiArray();
|
void testMultiArray();
|
||||||
void testLevenshtein();
|
void testLevenshtein();
|
||||||
|
void testTestUtilities();
|
||||||
};
|
};
|
||||||
|
|
||||||
CPPUNIT_TEST_SUITE_REGISTRATION(MiscTests);
|
CPPUNIT_TEST_SUITE_REGISTRATION(MiscTests);
|
||||||
|
@ -123,3 +135,18 @@ void MiscTests::testLevenshtein()
|
||||||
CPPUNIT_ASSERT_EQUAL(1_st, computeDamerauLevenshteinDistance("xxöxx", "xxäxx"));
|
CPPUNIT_ASSERT_EQUAL(1_st, computeDamerauLevenshteinDistance("xxöxx", "xxäxx"));
|
||||||
CPPUNIT_ASSERT_EQUAL(11_st, computeDamerauLevenshteinDistance("this is a long text", "this is too long for stack"));
|
CPPUNIT_ASSERT_EQUAL(11_st, computeDamerauLevenshteinDistance("this is a long text", "this is too long for stack"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Tests helper from TestUtilities namespace which aren't used in other tests anyways.
|
||||||
|
*/
|
||||||
|
void MiscTests::testTestUtilities()
|
||||||
|
{
|
||||||
|
const auto workingCopyPathForNestedTestFile = workingCopyPath("subdir/nested-testfile.txt");
|
||||||
|
CPPUNIT_ASSERT_EQUAL_MESSAGE("creation of subdirectories in working dir", "some file\n"s, readFile(workingCopyPathForNestedTestFile));
|
||||||
|
|
||||||
|
stringstream ss;
|
||||||
|
ss << asHexNumber(16);
|
||||||
|
CPPUNIT_ASSERT_EQUAL_MESSAGE("printing hex numbers", "0x10"s, ss.str());
|
||||||
|
|
||||||
|
TESTUTILS_ASSERT_LIKE("assert like works", ".*foo.*", " foo ");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue