// Check p-values and compare with the referece file void s_CheckPValues(const CRef<CScorePValues> pv, const string& filename) { BOOST_REQUIRE(!pv.Empty()); const vector<CScorePValues::TPValue>& pvalues = pv->GetPValues(); const vector<CScorePValues::TPValue>& errors = pv->GetErrors(); // P-values and errors arrays are of the same length BOOST_REQUIRE_EQUAL(pvalues.size(), errors.size()); // P-values and errors are positive for (size_t i=0;i < pvalues.size();i++) { BOOST_REQUIRE(pvalues[i] >= 0.0); BOOST_REQUIRE(errors[i] >= 0.0); } // Compare p-values and error to the reference values CNcbiIfstream istr_pv(filename.c_str()); BOOST_REQUIRE(istr_pv.is_open()); for (size_t j=0;j < pvalues.size();j++) { double target; BOOST_REQUIRE(!istr_pv.eof()); istr_pv >> target; BOOST_REQUIRE_CLOSE(pvalues[j], target, 1.0); istr_pv >> target; BOOST_REQUIRE_CLOSE(errors[j], target, 1.0); } }