gcov complains about one of my algorithms:
File 'Algorithm.h' Lines executed:95.00% of 20 Algorithm.h:creating 'Algorithm.h.gcov' 17: 25:inline std::vector<std::string> starts_with(const std::vector<std::string>& input, const std::string& startsWith) -: 26:{ 17: 27: std::vector<std::string> output; 17: 28: std::remove_copy_if(input.begin(), input.end(), std::back_inserter(output), !boost::bind(&boost::starts_with<std::string,std::string>, _1, startsWith)); #####: 29: return output; -: 30:} My test looks like this, and it passes:
TEST (TestAlgorithm, starts_with) { std::vector<std::string> input = boost::assign::list_of("1")("2")("22")("33")("222"); EXPECT_TRUE(starts_with(input,"22") == boost::assign::list_of("22")("222")); } What might the problem be? I'm not using optimization.
UPDATE:
My CMakeList.txt contains:
if(CMAKE_COMPILER_IS_GNUCXX) set(CMAKE_CXX_FLAGS "-O0") ## Optimize endif()