/*******************************************************************************
 * Copyright (c) 2025 Olivier Langella
 *<Olivier.Langella@universite-paris-saclay.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/>.
 *
 ******************************************************************************/


// ./tests/catch2-only-tests [qualifiedspectrum] -s


#include <catch2/catch_test_macros.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/matchers/catch_matchers_vector.hpp>
#include <pappsomspp/core/massspectrum/qualifiedmassspectrum.h>
#include "common.h"
#include "tests/tests-config.h"


TEST_CASE("test for qualifiedspectrum.", "[qualifiedspectrum]")
{
  // Set the debugging message formatting pattern.
  qSetMessagePattern(QString("%{file}@%{line}, %{function}(): %{message}"));

  SECTION("..:: Check20120906_balliau_extract_1_A01_urnb-1_4291 ::..", "[qualifiedspectrum]")
  {

    pappso::QualifiedMassSpectrum qualified_spectrum = readQualifiedMassSpectrumMgf(
      QString(CMAKE_SOURCE_DIR)
        .append("/tests/data/scans/20120906_balliau_extract_1_A01_urnb-1_4291.mgf"));
    // TITLE = 20120906_balliau_extract_1_A01_urnb - 1.4292.4292.2
    // // RTINSECONDS = 1090.27614
    //  PEPMASS =             657.801696777344 1052902.625
    //  CHARGE =                2 +

    REQUIRE(qualified_spectrum.getPrecursorMz() == Catch::Approx(657.80169677734397));
    REQUIRE(qualified_spectrum.getPrecursorCharge() == 2);
    REQUIRE(qualified_spectrum.getPrecursorMass() == Catch::Approx(1313.58884062092988643));
  }
}
