Commit 8021b07e84daad18c0ee75ee352469bdb73544bd
1 parent
8868d41d
Fix some cppcheck issues
Showing
31 changed files
with
48 additions
and
143 deletions
inst/cta/include/GCTAResponseCube.hpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAResponseCube.hpp - CTA cube analysis response function class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2014-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -112,7 +112,6 @@ private: |
| 112 | 112 | void init_members(void); |
| 113 | 113 | void copy_members(const GCTAResponseCube& rsp); |
| 114 | 114 | void free_members(void); |
| 115 | - int cache_index(const std::string& name) const; | |
| 116 | 115 | double psf_radial(const GModelSpatialRadial* model, |
| 117 | 116 | const double& rho_obs, |
| 118 | 117 | const GSkyDir& obsDir, | ... | ... |
inst/cta/src/GCTAModelAeffBackground.cpp
| ... | ... | @@ -768,7 +768,6 @@ void GCTAModelAeffBackground::read(const GXmlElement& xml) |
| 768 | 768 | |
| 769 | 769 | // Initialise XML elements |
| 770 | 770 | const GXmlElement* spectral = NULL; |
| 771 | - const GXmlElement* temporal = NULL; | |
| 772 | 771 | |
| 773 | 772 | // Get pointer on spectrum |
| 774 | 773 | spectral = xml.element("spectrum", 0); |
| ... | ... | @@ -778,7 +777,7 @@ void GCTAModelAeffBackground::read(const GXmlElement& xml) |
| 778 | 777 | |
| 779 | 778 | // Optionally get temporal model |
| 780 | 779 | if (xml.elements("temporalModel")) { |
| 781 | - temporal = xml.element("temporalModel", 0); | |
| 780 | + const GXmlElement* temporal = xml.element("temporalModel", 0); | |
| 782 | 781 | m_temporal = xml_temporal(*temporal); |
| 783 | 782 | } |
| 784 | 783 | else { | ... | ... |
inst/cta/src/GCTAModelBackground.cpp
| ... | ... | @@ -521,7 +521,6 @@ GCTAEventList* GCTAModelBackground::mc(const GObservation& obs, |
| 521 | 521 | // Get reference on CTA pointing, background response and event list |
| 522 | 522 | // from observation |
| 523 | 523 | const GCTAObservation& cta = gammalib::cta_obs(G_MC, obs); |
| 524 | - const GCTAPointing& pnt = gammalib::cta_pnt(G_MC, obs); | |
| 525 | 524 | const GCTAEventList& events = gammalib::cta_event_list(G_MC, obs); |
| 526 | 525 | |
| 527 | 526 | // Get simulation region | ... | ... |
inst/cta/src/GCTAModelCubeBackground.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GCTAModelCubeBackground.cpp - CTA cube background model class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2013-2018 by Michael Mayer * | |
| 4 | + * copyright (C) 2013-2020 by Michael Mayer * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -551,7 +551,6 @@ void GCTAModelCubeBackground::read(const GXmlElement& xml) |
| 551 | 551 | |
| 552 | 552 | // Initialise XML elements |
| 553 | 553 | const GXmlElement* spectral = NULL; |
| 554 | - const GXmlElement* temporal = NULL; | |
| 555 | 554 | |
| 556 | 555 | // Get pointer on spectrum |
| 557 | 556 | spectral = xml.element("spectrum", 0); |
| ... | ... | @@ -561,7 +560,7 @@ void GCTAModelCubeBackground::read(const GXmlElement& xml) |
| 561 | 560 | |
| 562 | 561 | // Optionally get temporal model |
| 563 | 562 | if (xml.elements("temporalModel")) { |
| 564 | - temporal = xml.element("temporalModel", 0); | |
| 563 | + const GXmlElement* temporal = xml.element("temporalModel", 0); | |
| 565 | 564 | m_temporal = xml_temporal(*temporal); |
| 566 | 565 | } |
| 567 | 566 | else { | ... | ... |
inst/cta/src/GCTAModelIrfBackground.cpp
| ... | ... | @@ -699,7 +699,6 @@ void GCTAModelIrfBackground::read(const GXmlElement& xml) |
| 699 | 699 | |
| 700 | 700 | // Initialise XML elements |
| 701 | 701 | const GXmlElement* spectral = NULL; |
| 702 | - const GXmlElement* temporal = NULL; | |
| 703 | 702 | |
| 704 | 703 | // Get pointer on spectrum |
| 705 | 704 | spectral = xml.element("spectrum", 0); |
| ... | ... | @@ -709,7 +708,7 @@ void GCTAModelIrfBackground::read(const GXmlElement& xml) |
| 709 | 708 | |
| 710 | 709 | // Optionally get temporal model |
| 711 | 710 | if (xml.elements("temporalModel")) { |
| 712 | - temporal = xml.element("temporalModel", 0); | |
| 711 | + const GXmlElement* temporal = xml.element("temporalModel", 0); | |
| 713 | 712 | m_temporal = xml_temporal(*temporal); |
| 714 | 713 | } |
| 715 | 714 | else { | ... | ... |
inst/cta/src/GCTAModelRadialAcceptance.cpp
| ... | ... | @@ -664,7 +664,6 @@ void GCTAModelRadialAcceptance::read(const GXmlElement& xml) |
| 664 | 664 | // Initialise XML elements |
| 665 | 665 | const GXmlElement* rad = NULL; |
| 666 | 666 | const GXmlElement* spec = NULL; |
| 667 | - const GXmlElement* temp = NULL; | |
| 668 | 667 | |
| 669 | 668 | // Get pointers on spectrum and radial model |
| 670 | 669 | rad = xml.element("radialModel", 0); |
| ... | ... | @@ -676,7 +675,7 @@ void GCTAModelRadialAcceptance::read(const GXmlElement& xml) |
| 676 | 675 | |
| 677 | 676 | // Optionally get temporal model |
| 678 | 677 | try { |
| 679 | - temp = xml.element("lightcurve", 0); | |
| 678 | + const GXmlElement* temp = xml.element("lightcurve", 0); | |
| 680 | 679 | m_temporal = xml_temporal(*temp); |
| 681 | 680 | } |
| 682 | 681 | catch (GException::xml_name_not_found &e) { | ... | ... |
inst/cta/src/GCTAModelSpatial.cpp
| ... | ... | @@ -299,7 +299,6 @@ GCTAInstDir GCTAModelSpatial::mc(const GEnergy& energy, |
| 299 | 299 | // Initialise rejection method |
| 300 | 300 | double f = 0.0; |
| 301 | 301 | double ftest = 1.0; |
| 302 | - int zeros = 0; | |
| 303 | 302 | const int max_subsequent_zeros = 10; |
| 304 | 303 | |
| 305 | 304 | // Find instrument direction by rejection method | ... | ... |
inst/cta/src/GCTAOnOffObservation.cpp
| ... | ... | @@ -970,8 +970,8 @@ GPha GCTAOnOffObservation::model_background(const GModels& models) const |
| 970 | 970 | |
| 971 | 971 | // Perform likelihood profiling and derive likelihood value |
| 972 | 972 | // The number of background counts is updated to the profile value |
| 973 | - double logL = wstat_value(non, noff, alpha, ngam, nonpred, nbgd, | |
| 974 | - dlogLdsky,d2logLdsky2); | |
| 973 | + wstat_value(non, noff, alpha, ngam, nonpred, nbgd, | |
| 974 | + dlogLdsky,d2logLdsky2); | |
| 975 | 975 | |
| 976 | 976 | } // endelse: WSTAT |
| 977 | 977 | |
| ... | ... | @@ -2463,9 +2463,6 @@ double GCTAOnOffObservation::N_bgd(const GModels& models, |
| 2463 | 2463 | // Continue only if bin number is valid and if there are model parameters |
| 2464 | 2464 | if ((ibin >= 0) && (ibin < m_on_spec.size()) && (npars > 0)) { |
| 2465 | 2465 | |
| 2466 | - // Initialise parameter index | |
| 2467 | - int ipar = 0; | |
| 2468 | - | |
| 2469 | 2466 | // Get reconstructed energy bin mean and width |
| 2470 | 2467 | GEnergy emean = m_on_spec.ebounds().elogmean(ibin); |
| 2471 | 2468 | double ewidth = m_on_spec.ebounds().ewidth(ibin).MeV(); |
| ... | ... | @@ -2482,7 +2479,7 @@ double GCTAOnOffObservation::N_bgd(const GModels& models, |
| 2482 | 2479 | double norm = background * exposure * ewidth; |
| 2483 | 2480 | |
| 2484 | 2481 | // Loop over models |
| 2485 | - for (int j = 0; j < models.size(); ++j) { | |
| 2482 | + for (int j = 0, ipar = 0; j < models.size(); ++j) { | |
| 2486 | 2483 | |
| 2487 | 2484 | // Get model pointer. Fall through if pointer is not valid |
| 2488 | 2485 | const GModel* mptr = models[j]; |
| ... | ... | @@ -2666,18 +2663,17 @@ double GCTAOnOffObservation::likelihood_cstat(const GModels& models, |
| 2666 | 2663 | int n_zero_data = 0; |
| 2667 | 2664 | double sum_data = 0.0; |
| 2668 | 2665 | double sum_model = 0.0; |
| 2669 | - double init_npred = *npred; | |
| 2670 | 2666 | #endif |
| 2671 | 2667 | |
| 2672 | - // Initialise log-likelihood value | |
| 2668 | + // Initialise log-likelihood value | |
| 2673 | 2669 | double value = 0.0; |
| 2674 | 2670 | |
| 2675 | - // Get number of model parameters in model container | |
| 2671 | + // Get number of model parameters in model container | |
| 2676 | 2672 | int npars = models.npars(); |
| 2677 | 2673 | |
| 2678 | - // Create model gradient vectors for sky and background parameters | |
| 2679 | - GVector sky_grad(npars); | |
| 2680 | - GVector bgd_grad(npars); | |
| 2674 | + // Create model gradient vectors for sky and background parameters | |
| 2675 | + GVector sky_grad(npars); | |
| 2676 | + GVector bgd_grad(npars); | |
| 2681 | 2677 | |
| 2682 | 2678 | // Allocate working array |
| 2683 | 2679 | GVector colvar(npars); |
| ... | ... | @@ -2909,7 +2905,6 @@ double GCTAOnOffObservation::likelihood_wstat(const GModels& models, |
| 2909 | 2905 | int n_used = 0; |
| 2910 | 2906 | double sum_data = 0.0; |
| 2911 | 2907 | double sum_model = 0.0; |
| 2912 | - double init_npred = *npred; | |
| 2913 | 2908 | #endif |
| 2914 | 2909 | |
| 2915 | 2910 | // Initialise log-likelihood value | ... | ... |
inst/cta/src/GCTAResponseCube.cpp
| ... | ... | @@ -685,37 +685,6 @@ void GCTAResponseCube::free_members(void) |
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
| 688 | -/***********************************************************************//** | |
| 689 | - * @brief Determine cache index for model | |
| 690 | - * | |
| 691 | - * @param[in] name Model name. | |
| 692 | - * @return Cache index (-1 if model has not been found). | |
| 693 | - * | |
| 694 | - * Determines the cache index for a given model @p name. | |
| 695 | - ***************************************************************************/ | |
| 696 | -int GCTAResponseCube::cache_index(const std::string& name) const | |
| 697 | -{ | |
| 698 | - // Initialise index | |
| 699 | - int index = -1; | |
| 700 | - | |
| 701 | - // Continue only if there are models in cache | |
| 702 | - if (!m_cache.empty()) { | |
| 703 | - | |
| 704 | - // Search for model name | |
| 705 | - for (int i = 0; i < m_cache.size(); ++i) { | |
| 706 | - if (m_cache[i]->name() == name) { | |
| 707 | - index = i; | |
| 708 | - break; | |
| 709 | - } | |
| 710 | - } | |
| 711 | - | |
| 712 | - } // endif: there were models in cache | |
| 713 | - | |
| 714 | - // Return index | |
| 715 | - return index; | |
| 716 | -} | |
| 717 | - | |
| 718 | - | |
| 719 | 688 | #if defined(G_RADIAL_PSF_BASED) |
| 720 | 689 | /***********************************************************************//** |
| 721 | 690 | * @brief Integrate Psf over radial model |
| ... | ... | @@ -1554,10 +1523,10 @@ double GCTAResponseCube::irf_diffuse(const GEvent& event, |
| 1554 | 1523 | } |
| 1555 | 1524 | |
| 1556 | 1525 | // Apply deadtime correction |
| 1557 | - irf *= exposure().deadc(); | |
| 1526 | + irf *= deadc; | |
| 1558 | 1527 | |
| 1559 | 1528 | } // endif: exposure was positive |
| 1560 | - | |
| 1529 | + | |
| 1561 | 1530 | } // endif: livetime was positive |
| 1562 | 1531 | |
| 1563 | 1532 | // Compile option: Check for NaN/Inf | ... | ... |
inst/cta/src/GCTASupport.cpp
| ... | ... | @@ -252,7 +252,7 @@ GPhases gammalib::read_ds_phase(const GFitsHDU& hdu) |
| 252 | 252 | |
| 253 | 253 | // Set data sub-space key strings |
| 254 | 254 | std::string type_key = "DSTYP"+gammalib::str(i); |
| 255 | - std::string unit_key = "DSUNI"+gammalib::str(i); | |
| 255 | + //std::string unit_key = "DSUNI"+gammalib::str(i); | |
| 256 | 256 | std::string value_key = "DSVAL"+gammalib::str(i); |
| 257 | 257 | |
| 258 | 258 | // Continue only if type_key is found and if this key is PHASE |
| ... | ... | @@ -318,7 +318,7 @@ std::string gammalib::read_ds_gti_extname(const GFitsHDU& hdu) |
| 318 | 318 | |
| 319 | 319 | // Set data sub-space key strings |
| 320 | 320 | std::string type_key = "DSTYP"+gammalib::str(i); |
| 321 | - std::string unit_key = "DSUNI"+gammalib::str(i); | |
| 321 | + //std::string unit_key = "DSUNI"+gammalib::str(i); | |
| 322 | 322 | std::string value_key = "DSVAL"+gammalib::str(i); |
| 323 | 323 | std::string ref_key = "DSREF"+gammalib::str(i); |
| 324 | 324 | ... | ... |
inst/lat/src/GLATEdisp.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEdisp.cpp - Fermi LAT energy dispersion * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2008-2018 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2008-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -253,9 +253,11 @@ void GLATEdisp::read(const GFits& fits, const std::string& evtype) |
| 253 | 253 | if (!fits.contains(engdisp)) { |
| 254 | 254 | engdisp += "_" + m_evtype; |
| 255 | 255 | } |
| 256 | + /* | |
| 256 | 257 | if (!fits.contains(escales)) { |
| 257 | 258 | escales += "_" + m_evtype; |
| 258 | 259 | } |
| 260 | + */ | |
| 259 | 261 | |
| 260 | 262 | // Get pointer to effective area HDU |
| 261 | 263 | const GFitsTable& hdu_edisp = *fits.table(engdisp); | ... | ... |
inst/lat/src/GLATEventList.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GLATEventList.cpp - Fermi/LAT event list class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2009-2017 by Juergen Knoedlseder * | |
| 4 | + * copyright (C) 2009-2020 by Juergen Knoedlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -548,9 +548,6 @@ void GLATEventList::read_events(const GFitsTable& table) |
| 548 | 548 | // Clear existing events |
| 549 | 549 | m_events.clear(); |
| 550 | 550 | |
| 551 | - // Allocate space for keyword name | |
| 552 | - char keyword[10]; | |
| 553 | - | |
| 554 | 551 | // Extract number of events in FT1 file |
| 555 | 552 | int num = table.integer("NAXIS2"); |
| 556 | 553 | |
| ... | ... | @@ -616,6 +613,9 @@ void GLATEventList::read_events(const GFitsTable& table) |
| 616 | 613 | // Load diffuse columns |
| 617 | 614 | for (int k = 0; k < num_difrsp; ++k) { |
| 618 | 615 | |
| 616 | + // Allocate space for keyword name | |
| 617 | + char keyword[10]; | |
| 618 | + | |
| 619 | 619 | // Set keyword name |
| 620 | 620 | std::sprintf(keyword, "DIFRSP%d", k); |
| 621 | 621 | ... | ... |
inst/spi/src/GSPIModelDataSpace.cpp
| ... | ... | @@ -874,9 +874,6 @@ void GSPIModelDataSpace::setup_pars(GSPIEventCube* cube) |
| 874 | 874 | for (int idet = 0; idet < ndet; ++idet) { |
| 875 | 875 | for (int ieng = 0; ieng < neng; ++ieng) { |
| 876 | 876 | |
| 877 | - // Set energy name | |
| 878 | - std::string eng_name = (eng_names.size() > 0) ? eng_names[ieng] : ""; | |
| 879 | - | |
| 880 | 877 | // Build parameter name |
| 881 | 878 | std::string par_name; |
| 882 | 879 | if (m_name.empty()) { | ... | ... |
inst/spi/src/GSPIResponse.cpp
| ... | ... | @@ -262,7 +262,6 @@ double GSPIResponse::irf(const GEvent& event, |
| 262 | 262 | // Extract INTEGRAL/SPI event cube |
| 263 | 263 | const GSPIEventCube* cube = dynamic_cast<const GSPIEventCube*>(spi_obs->events()); |
| 264 | 264 | if (cube == NULL) { |
| 265 | - std::string cls = std::string(typeid(&obs).name()); | |
| 266 | 265 | std::string msg = "INTEGRAL/SPI observation does not contain a valid " |
| 267 | 266 | "event cube. Please specify an observation with an " |
| 268 | 267 | "event cube as argument."; |
| ... | ... | @@ -1171,7 +1170,6 @@ void GSPIResponse::load_irfs(const int& region) |
| 1171 | 1170 | int nx = irf.nx(); |
| 1172 | 1171 | int ny = irf.ny(); |
| 1173 | 1172 | int ndet = irf.shape()[0]; |
| 1174 | - int nreg = irf.shape()[1]; | |
| 1175 | 1173 | |
| 1176 | 1174 | // Loop over requested regions |
| 1177 | 1175 | for (int i_region = 0; i_region < num_regions; ++i_region) { | ... | ... |
src/template/inst_test_XXX.cpp
| ... | ... | @@ -103,15 +103,12 @@ int main(void) |
| 103 | 103 | std::string caldb = "CALDB="+xxx_caldb; |
| 104 | 104 | putenv((char*)caldb.c_str()); |
| 105 | 105 | |
| 106 | - // Initially assume that we pass all tests | |
| 107 | - bool success = true; | |
| 108 | - | |
| 109 | 106 | // Create test suites and append them to the container |
| 110 | 107 | TestGXXX suite; |
| 111 | 108 | testsuites.append(suite); |
| 112 | 109 | |
| 113 | 110 | // Run the testsuites |
| 114 | - success = testsuites.run(); | |
| 111 | + bool success = testsuites.run(); | |
| 115 | 112 | |
| 116 | 113 | // Save test report |
| 117 | 114 | testsuites.save("reports/GXXX.xml"); | ... | ... |
src/vo/GVOHub.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * GVOHub.cpp - VO SAMP Hub class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2014-2019 by Thierry Louge * | |
| 4 | + * copyright (C) 2014-2020 by Thierry Louge * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software: you can redistribute it and/or modify * |
| ... | ... | @@ -2183,15 +2183,12 @@ std::string GVOHub::get_mtype(const GXml& xml) const |
| 2183 | 2183 | std::cout << "In GVOHub::get_mtype" << std::endl; |
| 2184 | 2184 | #endif |
| 2185 | 2185 | |
| 2186 | - // Initialise response | |
| 2187 | - std::string client_key = ""; | |
| 2188 | - | |
| 2189 | 2186 | // Get the XML node containing the client's private key |
| 2190 | 2187 | const GXmlNode* node = xml.element("methodCall > params > param[1] > " |
| 2191 | 2188 | "value > struct "); |
| 2192 | 2189 | |
| 2193 | 2190 | // Get the client's private key |
| 2194 | - client_key = get_response_value(node, "samp.mtype"); | |
| 2191 | + std::string client_key = get_response_value(node, "samp.mtype"); | |
| 2195 | 2192 | |
| 2196 | 2193 | // Return key |
| 2197 | 2194 | return client_key; | ... | ... |
test/test_GApplication.cpp
| ... | ... | @@ -692,9 +692,6 @@ int main(void) |
| 692 | 692 | // Allocate test suit container |
| 693 | 693 | GTestSuites testsuites("GApplication"); |
| 694 | 694 | |
| 695 | - // Initially assume that we pass all tests | |
| 696 | - bool success = true; | |
| 697 | - | |
| 698 | 695 | // Create a test suite |
| 699 | 696 | TestGApplication test; |
| 700 | 697 | |
| ... | ... | @@ -702,7 +699,7 @@ int main(void) |
| 702 | 699 | testsuites.append(test); |
| 703 | 700 | |
| 704 | 701 | // Run the testsuites |
| 705 | - success = testsuites.run(); | |
| 702 | + bool success = testsuites.run(); | |
| 706 | 703 | |
| 707 | 704 | // Save test report |
| 708 | 705 | testsuites.save("reports/GApplication.xml"); | ... | ... |
test/test_GFits.cpp
| ... | ... | @@ -1731,9 +1731,6 @@ int main(void) |
| 1731 | 1731 | // Allocate test suit container |
| 1732 | 1732 | GTestSuites testsuites("FITS module"); |
| 1733 | 1733 | |
| 1734 | - // Initially assume that we pass all tests | |
| 1735 | - bool success = true; | |
| 1736 | - | |
| 1737 | 1734 | // Create a test suite |
| 1738 | 1735 | TestGFits test; |
| 1739 | 1736 | |
| ... | ... | @@ -1741,7 +1738,7 @@ int main(void) |
| 1741 | 1738 | testsuites.append(test); |
| 1742 | 1739 | |
| 1743 | 1740 | // Run the testsuites |
| 1744 | - success = testsuites.run(); | |
| 1741 | + bool success = testsuites.run(); | |
| 1745 | 1742 | |
| 1746 | 1743 | // Save test report |
| 1747 | 1744 | testsuites.save("reports/GFits.xml"); | ... | ... |
test/test_GMatrix.cpp
| ... | ... | @@ -870,9 +870,6 @@ int main(void) |
| 870 | 870 | // Allocate test suit container |
| 871 | 871 | GTestSuites testsuites("GMatrix class testing"); |
| 872 | 872 | |
| 873 | - // Initially assume that we pass all tests | |
| 874 | - bool success = true; | |
| 875 | - | |
| 876 | 873 | // Create a test suite |
| 877 | 874 | TestGMatrix test; |
| 878 | 875 | |
| ... | ... | @@ -880,7 +877,7 @@ int main(void) |
| 880 | 877 | testsuites.append(test); |
| 881 | 878 | |
| 882 | 879 | // Run the testsuites |
| 883 | - success = testsuites.run(); | |
| 880 | + bool success = testsuites.run(); | |
| 884 | 881 | |
| 885 | 882 | // Save test report |
| 886 | 883 | testsuites.save("reports/GMatrix.xml"); | ... | ... |
test/test_GMatrixSparse.cpp
| ... | ... | @@ -1358,9 +1358,6 @@ int main(void) |
| 1358 | 1358 | // Allocate test suit container |
| 1359 | 1359 | GTestSuites testsuites("GMatrixSparse class testing"); |
| 1360 | 1360 | |
| 1361 | - // Initially assume that we pass all tests | |
| 1362 | - bool success = true; | |
| 1363 | - | |
| 1364 | 1361 | // Create a test suite |
| 1365 | 1362 | TestGMatrixSparse test; |
| 1366 | 1363 | |
| ... | ... | @@ -1368,7 +1365,7 @@ int main(void) |
| 1368 | 1365 | testsuites.append(test); |
| 1369 | 1366 | |
| 1370 | 1367 | // Run the testsuites |
| 1371 | - success = testsuites.run(); | |
| 1368 | + bool success = testsuites.run(); | |
| 1372 | 1369 | |
| 1373 | 1370 | // Save test report |
| 1374 | 1371 | testsuites.save("reports/GMatrixSparse.xml"); | ... | ... |
test/test_GMatrixSymmetric.cpp
| ... | ... | @@ -848,9 +848,6 @@ int main(void) |
| 848 | 848 | // Allocate test suit container |
| 849 | 849 | GTestSuites testsuites("GMatrixSymmetric class testing"); |
| 850 | 850 | |
| 851 | - // Initially assume that we pass all tests | |
| 852 | - bool success = true; | |
| 853 | - | |
| 854 | 851 | // Create a test suite |
| 855 | 852 | TestGMatrixSymmetric test; |
| 856 | 853 | |
| ... | ... | @@ -858,7 +855,7 @@ int main(void) |
| 858 | 855 | testsuites.append(test); |
| 859 | 856 | |
| 860 | 857 | // Run the testsuites |
| 861 | - success = testsuites.run(); | |
| 858 | + bool success = testsuites.run(); | |
| 862 | 859 | |
| 863 | 860 | // Save test report |
| 864 | 861 | testsuites.save("reports/GMatrixSymmetric.xml"); | ... | ... |
test/test_GModel.cpp
| ... | ... | @@ -3697,9 +3697,6 @@ int main(void) |
| 3697 | 3697 | // Create test suites |
| 3698 | 3698 | GTestSuites testsuite("GModel"); |
| 3699 | 3699 | |
| 3700 | - // Initialise success flag | |
| 3701 | - bool success = true; | |
| 3702 | - | |
| 3703 | 3700 | // Create a test suite |
| 3704 | 3701 | TestGModel test; |
| 3705 | 3702 | |
| ... | ... | @@ -3707,7 +3704,7 @@ int main(void) |
| 3707 | 3704 | testsuite.append(test); |
| 3708 | 3705 | |
| 3709 | 3706 | // Run the testsuites |
| 3710 | - success = testsuite.run(); | |
| 3707 | + bool success = testsuite.run(); | |
| 3711 | 3708 | |
| 3712 | 3709 | // Save xml report |
| 3713 | 3710 | testsuite.save("reports/GModel.xml"); | ... | ... |
test/test_GNumerics.cpp
| ... | ... | @@ -622,20 +622,18 @@ int main(void) |
| 622 | 622 | { |
| 623 | 623 | GTestSuites testsuite("GNumerics"); |
| 624 | 624 | |
| 625 | - bool was_successful=true; | |
| 626 | - | |
| 627 | - //Create a test suite | |
| 625 | + // Create a test suite | |
| 628 | 626 | TestGNumerics test; |
| 629 | 627 | |
| 630 | - //Append to the container | |
| 628 | + // Append to the container | |
| 631 | 629 | testsuite.append(test); |
| 632 | 630 | |
| 633 | - //Run | |
| 634 | - was_successful=testsuite.run(); | |
| 631 | + // Run | |
| 632 | + bool success = testsuite.run(); | |
| 635 | 633 | |
| 636 | - //save xml report | |
| 634 | + // save xml report | |
| 637 | 635 | testsuite.save("reports/GNumerics.xml"); |
| 638 | 636 | |
| 639 | 637 | // Return |
| 640 | - return was_successful ? 0:1; | |
| 638 | + return (success ? 0:1); | |
| 641 | 639 | } | ... | ... |
test/test_GObservation.cpp
| ... | ... | @@ -1923,9 +1923,6 @@ int main(void) |
| 1923 | 1923 | // Allocate test suit container |
| 1924 | 1924 | GTestSuites testsuites("Observation module"); |
| 1925 | 1925 | |
| 1926 | - // Initially assume that we pass all tests | |
| 1927 | - bool success = true; | |
| 1928 | - | |
| 1929 | 1926 | // Create and append test suites |
| 1930 | 1927 | TestGObservation obs; |
| 1931 | 1928 | testsuites.append(obs); |
| ... | ... | @@ -1937,7 +1934,7 @@ int main(void) |
| 1937 | 1934 | #endif |
| 1938 | 1935 | |
| 1939 | 1936 | // Run the testsuites |
| 1940 | - success = testsuites.run(); | |
| 1937 | + bool success = testsuites.run(); | |
| 1941 | 1938 | |
| 1942 | 1939 | // Save test report |
| 1943 | 1940 | testsuites.save("reports/GObservation.xml"); | ... | ... |
test/test_GOptimizer.cpp
| ... | ... | @@ -190,15 +190,12 @@ int main(void) |
| 190 | 190 | // Allocate test suit container |
| 191 | 191 | GTestSuites testsuites("Optimizer module"); |
| 192 | 192 | |
| 193 | - // Initially assume that we pass all tests | |
| 194 | - bool success = true; | |
| 195 | - | |
| 196 | 193 | // Create and append test suite |
| 197 | 194 | TestGOptimizer openmp; |
| 198 | 195 | testsuites.append(openmp); |
| 199 | 196 | |
| 200 | 197 | // Run the testsuites |
| 201 | - success = testsuites.run(); | |
| 198 | + bool success = testsuites.run(); | |
| 202 | 199 | |
| 203 | 200 | // Save test report |
| 204 | 201 | testsuites.save("reports/GOptimizer.xml"); | ... | ... |
test/test_GSky.cpp
| ... | ... | @@ -1837,8 +1837,6 @@ int main(void) |
| 1837 | 1837 | { |
| 1838 | 1838 | GTestSuites testsuites("GSky"); |
| 1839 | 1839 | |
| 1840 | - bool was_successful = true; | |
| 1841 | - | |
| 1842 | 1840 | // Create a test suite |
| 1843 | 1841 | TestGSky test; |
| 1844 | 1842 | |
| ... | ... | @@ -1846,7 +1844,7 @@ int main(void) |
| 1846 | 1844 | testsuites.append(test); |
| 1847 | 1845 | |
| 1848 | 1846 | // Run |
| 1849 | - was_successful=testsuites.run(); | |
| 1847 | + bool was_successful = testsuites.run(); | |
| 1850 | 1848 | |
| 1851 | 1849 | // Save xml report |
| 1852 | 1850 | testsuites.save("reports/GSky.xml"); | ... | ... |
test/test_GSupport.cpp
| ... | ... | @@ -988,9 +988,6 @@ int main(void) |
| 988 | 988 | // Allocate test suite container |
| 989 | 989 | GTestSuites testsuites("Support module"); |
| 990 | 990 | |
| 991 | - // Initially assume that we pass all tests | |
| 992 | - bool success = true; | |
| 993 | - | |
| 994 | 991 | // Create and append test suite |
| 995 | 992 | TestGSupport test; |
| 996 | 993 | |
| ... | ... | @@ -998,7 +995,7 @@ int main(void) |
| 998 | 995 | testsuites.append(test); |
| 999 | 996 | |
| 1000 | 997 | // Run the testsuites |
| 1001 | - success = testsuites.run(); | |
| 998 | + bool success = testsuites.run(); | |
| 1002 | 999 | |
| 1003 | 1000 | // Save test report |
| 1004 | 1001 | testsuites.save("reports/GSupport.xml"); | ... | ... |
test/test_GVO.cpp
| ... | ... | @@ -208,9 +208,6 @@ int main(void) |
| 208 | 208 | // into the test directory) |
| 209 | 209 | unsetenv("HOME"); |
| 210 | 210 | |
| 211 | - // Initially assume that we pass all tests | |
| 212 | - bool success = true; | |
| 213 | - | |
| 214 | 211 | // Create a test suite |
| 215 | 212 | TestGVO test; |
| 216 | 213 | |
| ... | ... | @@ -218,7 +215,7 @@ int main(void) |
| 218 | 215 | testsuites.append(test); |
| 219 | 216 | |
| 220 | 217 | // Run the testsuites |
| 221 | - success = testsuites.run(); | |
| 218 | + bool success = testsuites.run(); | |
| 222 | 219 | |
| 223 | 220 | // Save test report |
| 224 | 221 | testsuites.save("reports/GVO.xml"); | ... | ... |
test/test_GVector.cpp
| ... | ... | @@ -591,9 +591,6 @@ int main(void) |
| 591 | 591 | // Allocate test suite container |
| 592 | 592 | GTestSuites testsuites("GVector"); |
| 593 | 593 | |
| 594 | - // Initially assume that we pass all tests | |
| 595 | - bool was_successful=true; | |
| 596 | - | |
| 597 | 594 | // Create a test suite |
| 598 | 595 | TestGVector test; |
| 599 | 596 | |
| ... | ... | @@ -601,7 +598,7 @@ int main(void) |
| 601 | 598 | testsuites.append(test); |
| 602 | 599 | |
| 603 | 600 | // Run |
| 604 | - was_successful=testsuites.run(); | |
| 601 | + bool was_successful = testsuites.run(); | |
| 605 | 602 | |
| 606 | 603 | // Save xml report |
| 607 | 604 | testsuites.save("reports/GVector.xml"); | ... | ... |
test/test_GXml.cpp
| ... | ... | @@ -321,9 +321,6 @@ int main(void) |
| 321 | 321 | // Allocate test suit container |
| 322 | 322 | GTestSuites testsuites("XML module"); |
| 323 | 323 | |
| 324 | - // Initially assume that we pass all tests | |
| 325 | - bool success = true; | |
| 326 | - | |
| 327 | 324 | // Create a test suite |
| 328 | 325 | TestGXml test; |
| 329 | 326 | |
| ... | ... | @@ -331,7 +328,7 @@ int main(void) |
| 331 | 328 | testsuites.append(test); |
| 332 | 329 | |
| 333 | 330 | // Run the testsuites |
| 334 | - success = testsuites.run(); | |
| 331 | + bool success = testsuites.run(); | |
| 335 | 332 | |
| 336 | 333 | // Save test report |
| 337 | 334 | testsuites.save("reports/GXml.xml"); | ... | ... |
test/test_GXspec.cpp
| ... | ... | @@ -573,9 +573,6 @@ int main(void) |
| 573 | 573 | // Allocate test suit container |
| 574 | 574 | GTestSuites testsuites("Xspec module"); |
| 575 | 575 | |
| 576 | - // Initially assume that we pass all tests | |
| 577 | - bool success = true; | |
| 578 | - | |
| 579 | 576 | // Create a test suite |
| 580 | 577 | TestGXspec test; |
| 581 | 578 | |
| ... | ... | @@ -583,7 +580,7 @@ int main(void) |
| 583 | 580 | testsuites.append(test); |
| 584 | 581 | |
| 585 | 582 | // Run the testsuites |
| 586 | - success = testsuites.run(); | |
| 583 | + bool success = testsuites.run(); | |
| 587 | 584 | |
| 588 | 585 | // Save test report |
| 589 | 586 | testsuites.save("reports/GXspec.xml"); | ... | ... |