Compare commits

..

No commits in common. "355daa934d4b442929ecb9975e96848688539468" and "6cf49681fa2206b78fc57324ed08f28f93d2df0e" have entirely different histories.

2 changed files with 1 additions and 69 deletions

View File

@ -1,75 +1,22 @@
/**
* \file Основной файл проекта
*/
#include "processor.hpp"
#include <QCoreApplication>
#include <QDebug>
#include <QFile>
#include <QRandomGenerator>
#include <QTimer>
/**
* @brief Перевод строки в целое число
* @param Строка
* @return Целое число
*/
int qStringToInt( const QString s )
{
return( s.toInt() );
}
/**
* \brief Неиспользуемая функция для тестирования анализа покрытия кода
*/
int unused( int a )
{
return( a );
}
/**
* \brief Медленная функция
*/
int slowFunction()
{
constexpr int size = 16 * 1024;
double a[size];
for ( int i = 0; i < size; i++ )
{
a[i] = QRandomGenerator::global()->bounded( 4 );
for ( int j = 0; j < i; j++ ) a[i] += sin( a[j] );
a[0] += a[i];
}
return( qRound( a[0] ) );
} // slowFunction
/**
* \brief Быстрая функция
*/
int fastFunction()
{
constexpr int size = 8 * 1024;
double a[size];
for ( int i = 0; i < size; i++ )
{
a[i] = QRandomGenerator::global()->bounded( 4 );
for ( int j = 0; j < i; j++ ) a[i] += sin( a[j] );
a[0] += a[i];
}
return( qRound( a[0] ) );
}
/**
* \brief Основная функция
* \param argc Количество параметров командной строки
* \param argv Массив параметров
* \return Результат выполнения QApplication::exec()
*/
int main( int argc, char** argv )
{
QCoreApplication app( argc, argv );
@ -102,11 +49,6 @@ int main( int argc, char** argv )
QObject::connect( &app, SIGNAL(aboutToQuit()), &p, SLOT(process()));
QTimer::singleShot( 100, &app, SLOT(quit()));
#ifdef PROFILE
qCritical() << "Slow: " << slowFunction();
qCritical() << "Fast: " << fastFunction();
#endif
int arr[3];
qCritical() << arr[2];
return( QCoreApplication::exec() );

View File

@ -1,7 +1,3 @@
/**
* \file Класс Processor
*/
#ifndef PROCESSOR_HPP_
#define PROCESSOR_HPP_
@ -10,17 +6,11 @@
#include <QObject>
#include <QDebug>
/**
* \brief Класс Processor
*/
class Processor : public QObject
{
Q_OBJECT
public:
/**
* \brief Слот, печатающий сообщение
*/
Q_SLOT void process() { qCritical() << "about to close"; }
};
#endif // ifndef PROCESSOR_HPP_
#endif