mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
compressed_archive_test added
This commit is contained in:
parent
743d896649
commit
e62d696339
17
tests/compressed_archive_test/compressed_archive_test.pro
Normal file
17
tests/compressed_archive_test/compressed_archive_test.pro
Normal file
@ -0,0 +1,17 @@
|
||||
TEMPLATE = app
|
||||
CONFIG += console
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
|
||||
win32 {
|
||||
LIBS += -loleaut32 -lole32
|
||||
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT
|
||||
QMAKE_LFLAGS_RELEASE += /LTCG
|
||||
CONFIG -= embed_manifest_exe
|
||||
}
|
||||
|
||||
include(../../compressed_archive/wrapper.pri)
|
||||
|
||||
|
||||
|
82
tests/compressed_archive_test/main.cpp
Normal file
82
tests/compressed_archive_test/main.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QDir>
|
||||
#include <QElapsedTimer>
|
||||
|
||||
#include "compressed_archive.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
//This program uses PROTOS Genome Test Suite c10-archive [0] for testing the CompressedArchive wrapper files support
|
||||
//It tests the following formats: RAR, ZIP, TAR
|
||||
//Arter downloading c10-archive-r1.iso, open it and full extract RAR_TAR.BZ2, ZIP_TAR.BZ2, TAR_TAR.BZ2 files into a folder
|
||||
//This program takes the path to that folder as an argument
|
||||
//
|
||||
// [0] https://www.ee.oulu.fi/research/ouspg/PROTOS_Test-Suite_c10-archive#Download
|
||||
//
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if(argc < 2)
|
||||
{
|
||||
cout << "Usage: compressed_archive_test PATH" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
|
||||
QString s(argv[1]);
|
||||
|
||||
QStringList supportedFormats;
|
||||
supportedFormats << "rar" << "zip" << "tar";
|
||||
|
||||
QElapsedTimer timer;
|
||||
timer.start();
|
||||
|
||||
quint32 totalFiles = 0;
|
||||
foreach (QString format, supportedFormats) {
|
||||
QDir rootDir(s);
|
||||
if(!rootDir.cd(format))
|
||||
{
|
||||
cout << "Folder for format '" << format.toStdString() << "' not found" << endl;
|
||||
continue;
|
||||
}
|
||||
rootDir.setFilter(QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
QFileInfoList files = rootDir.entryInfoList();
|
||||
quint32 totalFormat = 0;
|
||||
quint32 errors = 0;
|
||||
quint64 init = timer.elapsed();
|
||||
|
||||
foreach(QFileInfo fileInfo, files)
|
||||
{
|
||||
totalFiles++;
|
||||
totalFormat++;
|
||||
CompressedArchive archive(fileInfo.filePath());
|
||||
if(!archive.isValid())
|
||||
errors++;
|
||||
else
|
||||
{
|
||||
int i = archive.getNumFiles();
|
||||
cerr << i;
|
||||
cerr << archive.getFileNames().at(0).toStdString();
|
||||
}
|
||||
}
|
||||
quint64 end = timer.elapsed();
|
||||
|
||||
|
||||
cout << "Format '" << format.toStdString() <<"'" << endl;
|
||||
cout << "Total files : " << totalFormat << endl;
|
||||
cout << "Errors : " << errors << endl;
|
||||
cout << "Elapsed time : " << (end - init) / 1000000 <<"s" << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
cout << "Total time : " << timer.elapsed() / 1000000 <<"s" <<endl;
|
||||
cout << endl;
|
||||
|
||||
return app.exec();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user