<commit_before><commit_msg>added simple unittest<commit_after>#include <iostream>

#include <iostream>
#include <string>
#include <list>
#include <cppunit/TestCase.h>
#include <cppunit/TestFixture.h>
#include <cppunit/ui/text/TextTestRunner.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
#include <cppunit/CompilerOutputter.h>

//*****************************************************

class MathClass {
public:
int adder(int a, int b);
int subber(int a, int b);
};

int MathClass::adder(int a, int b) {
	return a + b;	
}

int MathClass::subber(int a, int b) {
	return a - b;
};

//******************************************************

class MathTester : public CppUnit::TestFixture {
	CPPUNIT_TEST_SUITE(MathTester);
	CPPUNIT_TEST(testAdd);
	CPPUNIT_TEST(testSub);
	CPPUNIT_TEST_SUITE_END();

public:
void setUp(void);
void tearDown(void);

protected:
void testAdd(void);
void testSub(void);

private:
MathClass *testObject;
};

void MathTester::testAdd(void) {
	CPPUNIT_ASSERT(5 == testObject->adder(2,3));
}

void MathTester::testSub(void) {
	CPPUNIT_ASSERT(2 == testObject->subber(5,3));
}

void MathTester::setUp(void) {
	testObject = new MathClass();
}

void MathTester::tearDown(void) {
	delete testObject;
}

//***********************************************************

CPPUNIT_TEST_SUITE_REGISTRATION(MathTester);

int main(){
	CPPUNIT_NS::TestResult test_result;

	CPPUNIT_NS::TestResultCollector collector;
	test_result.addListener(&collector);

	CPPUNIT_NS::BriefTestProgressListener progress;
	test_result.addListener (&progress);

	CPPUNIT_NS::TestRunner testrunner;
	testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest ());
	testrunner.run(test_result);

	CPPUNIT_NS::CompilerOutputter compileroutputter(&collector, std::cerr);
	compileroutputter.write ();

	return collector.wasSuccessful() ? 0 : 1;
}
{'fraction_non_alphanumeric': 0.20693020985846755, 'fraction_numerical': 0.003904343582235237, 'mean_word_length': 7.686440677966102, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7079958', 'n_tokens_mistral': 703, 'n_tokens_neox': 686, 'n_words': 122}