<commit_before>/*
    oscartestbase.h - OSCAR Testlib base

    Copyright (c) 2006 by <NAME> <<EMAIL>>

    Kopete    (c) 2002-2006 by the Kopete developers  <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/
#ifndef OSCARTESTBASE_H
#define OSCARTESTBASE_H

#include <QtTest/QtTest>
#include <QObject>
#include <QString>

class Buffer;

/**
 * @brief Base testcase class
 */
class OscarTestBase : public QObject
{
Q_OBJECT
public:
	OscarTestBase();

	/** Default destructor */
	~OscarTestBase();

	/**
	 * Set the directory to use to load test files
	 */
	void setPath( const QString& path );

	/**
	 * Takes a file @p file and attempts to load the file, prepending
	 * the path specified in the constructor as test data.
	 * @returns bool true on success.
	 */
	bool loadFile(const QString& file);
protected:
	Buffer* m_data;
	QString m_dataDir;
};

#define OSCAR_TEST_MAIN(TestObject) \
int main(int argc, char **argv) \
{ \
	QCoreApplication app(argc, argv); \
	TestObject tc; \
	if(argv[1]) \
		tc.setPath( argv[1] ); \
	return QTest::qExec( &tc, argc, argv); \
}

#endif
<commit_msg>set default path to the build dir when no path is given<commit_after>/*
    oscartestbase.h - OSCAR Testlib base

    Copyright (c) 2006 by <NAME> <<EMAIL>>

    Kopete    (c) 2002-2006 by the Kopete developers  <<EMAIL>>

    *************************************************************************
    *                                                                       *
    * This library is free software; you can redistribute it and/or         *
    * modify it under the terms of the GNU Lesser General Public            *
    * License as published by the Free Software Foundation; either          *
    * version 2 of the License, or (at your option) any later version.      *
    *                                                                       *
    *************************************************************************
*/
#ifndef OSCARTESTBASE_H
#define OSCARTESTBASE_H

#include <QtTest/QtTest>
#include <QObject>
#include <QString>

class Buffer;

/**
 * @brief Base testcase class
 */
class OscarTestBase : public QObject
{
Q_OBJECT
public:
	OscarTestBase();

	/** Default destructor */
	~OscarTestBase();

	/**
	 * Set the directory to use to load test files
	 */
	void setPath( const QString& path );

	/**
	 * Takes a file @p file and attempts to load the file, prepending
	 * the path specified in the constructor as test data.
	 * @returns bool true on success.
	 */
	bool loadFile(const QString& file);
protected:
	Buffer* m_data;
	QString m_dataDir;
};

#define OSCAR_TEST_MAIN(TestObject) \
int main(int argc, char **argv) \
{ \
	QCoreApplication app(argc, argv); \
	TestObject tc; \
	if(argv[1]) \
		tc.setPath( argv[1] ); \
	else \
		tc.setPath( QDir::current().absolutePath() ); \
	return QTest::qExec( &tc, argc, argv); \
}

#endif

{'fraction_non_alphanumeric': 0.1771014492753623, 'fraction_numerical': 0.008695652173913044, 'mean_word_length': 2.440677966101695, 'pattern_counts': {'":': 0, '<': 19, '<?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': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '520500', 'n_tokens_mistral': 1006, 'n_tokens_neox': 942, 'n_words': 328}