diff --git a/libgnucash/engine/test/test-qofid.cpp b/libgnucash/engine/test/test-qofid.cpp index b9fbd4b76f..3e0b5cf34f 100644 --- a/libgnucash/engine/test/test-qofid.cpp +++ b/libgnucash/engine/test/test-qofid.cpp @@ -27,11 +27,11 @@ #include #include -#include "../qofid.h" -#include "../qofid-p.h" -#include "../qofbook.h" -#include "../gncJob.h" -#include "../qofinstance-p.h" +#include "qofid.h" +#include "qofid-p.h" +#include "qofbook.h" +#include "gncJob.h" +#include "qofinstance-p.h" // This is the error handler that does nothing but count how many times it is // called. The handler_count is incremented every time. @@ -150,19 +150,17 @@ static gint cb_compare(GncJob* job1, GncJob* job2) return g_strcmp0(gncJobGetID(job1), gncJobGetID(job2)); } -static bool is_in(const char* str, const std::vector str_vect) +static bool is_in(const char* str, const std::vector& str_vect) { - for(auto id : str_vect) - if(!g_strcmp0(id, str)) - return true; - return false; + return std::find_if(str_vect.begin(), str_vect.end(), + [str](auto id)->bool{ return !g_strcmp0(id, str); }) != str_vect.end(); } TEST(QofIDTest, collection_foreach) { auto col = qof_collection_new(GNC_ID_JOB); auto book = qof_book_new(); - auto job_ids = std::vector{"zzz", "ggg", "qqq", "aaa"}; + std::vector job_ids{"zzz", "ggg", "qqq", "aaa"}; std::vector jobs; for(auto id : job_ids) {