1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
|
/*******************************************************************************
* Copyright (c) 2019 Olivier Langella <Olivier.Langella@u-psud.fr>.
*
* This file is part of the PAPPSOms++ library.
*
* PAPPSOms++ is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms++ is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
// make test ARGS="-V -I 21,21"
// cmake .. -DCMAKE_BUILD_TYPE=Debug -DMAKE_TEST=1 -DUSEPAPPSOTREE=1
//./tests/catch2-only-tests [MsRun] -s
#include <catch2/catch_test_macros.hpp>
#include <iostream>
#include <pappsomspp/core/pappsoexception.h>
#include <pappsomspp/core/exception/exceptionnotpossible.h>
#include <pappsomspp/core/msfile/msfileaccessor.h>
#include <pappsomspp/core/msrun/output/mzxmloutput.h>
#include <QDebug>
#include <QtCore>
#include <QFile>
#include <QtConcurrent>
#include "config.h"
// #include "common.h"
using namespace std;
TEST_CASE("Test MsRun output", "[MsRun]")
{
// Set the debugging message formatting pattern.
qSetMessagePattern(QString("%{file}@%{line}, %{function}(): %{message}"));
SECTION("..:: Test Qexception transferred accross threads ::..")
{
// QCoreApplication a(argc, argv);
std::cout << std::endl
<< "..:: Test Qexception transferred accross threads ::.."
<< std::endl;
QFuture<void> future = QtConcurrent::run([=]() {
throw pappso::ExceptionNotPossible(
QObject::tr("Not possible, but possible to catch it accross threads"));
});
REQUIRE_THROWS_AS(future.waitForFinished(), pappso::PappsoException);
}
// return 0;
qDebug() << "init test MSrun output";
std::cout << std::endl << "..:: Test MSrun output ::.." << std::endl;
QTime timer;
#if USEPAPPSOTREE == 1
SECTION("..:: Test MSrun output starts ::..")
{
pappso::MsFileAccessor file_access_A01(
"/gorgone/pappso/data_extraction_pappso/mzXML/"
// "/data/mzXML/"
//"/home/langella/data1/mzxml/"
"20120906_balliau_extract_1_A01_urnb-1.mzXML",
"");
std::cout << "number of runIds = " << file_access_A01.getMsRunIds().size()
<< std::endl;
pappso::MsRunReaderSPtr msrunA01 =
file_access_A01.getMsRunReaderSPtrByRunId("", "runa01");
QTextStream outputStream(stdout, QIODevice::WriteOnly);
// pappso::MzxmlOutput mzxml_ouput(outputStream.device());
// mzxml_ouput.write(msrunA01.get());
// mzxml_ouput.close();
}
#endif
}
|