From 586b6378dc605c97b2031481a1a5ab1009175a7e Mon Sep 17 00:00:00 2001 From: Andreas Eknes Lie Date: Mon, 18 Sep 2023 14:27:10 +0200 Subject: [PATCH] fixup! Inline job_list_reset and remove job_list_get_size --- src/clib/lib/include/ert/job_queue/job_list.hpp | 1 + src/clib/lib/job_queue/job_list.cpp | 4 ++++ src/clib/old_tests/job_queue/test_job_list.cpp | 8 ++------ 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/clib/lib/include/ert/job_queue/job_list.hpp b/src/clib/lib/include/ert/job_queue/job_list.hpp index 8269ea0e33c..c4e6c4a62c3 100644 --- a/src/clib/lib/include/ert/job_queue/job_list.hpp +++ b/src/clib/lib/include/ert/job_queue/job_list.hpp @@ -9,6 +9,7 @@ typedef struct job_list_struct job_list_type; job_list_type *job_list_alloc(); void job_list_free(job_list_type *job_list); void job_list_add_job(job_list_type *job_list, job_queue_node_type *job_node); +size_t job_list_get_size(const job_list_type *job_list); void job_list_get_wrlock(job_list_type *list); void job_list_get_rdlock(job_list_type *list); void job_list_unlock(job_list_type *list); diff --git a/src/clib/lib/job_queue/job_list.cpp b/src/clib/lib/job_queue/job_list.cpp index 964e3f41d7d..f3fc4a84d22 100644 --- a/src/clib/lib/job_queue/job_list.cpp +++ b/src/clib/lib/job_queue/job_list.cpp @@ -17,6 +17,10 @@ void job_list_add_job(job_list_type *job_list, job_queue_node_type *job_node) { job_list->vec_jobs.push_back(job_node); } +size_t job_list_get_size(const job_list_type *job_list) { + return job_list->vec_jobs.size(); +} + void job_list_free(job_list_type *job_list) { for (auto &vec_job : job_list->vec_jobs) job_queue_node_free(vec_job); diff --git a/src/clib/old_tests/job_queue/test_job_list.cpp b/src/clib/old_tests/job_queue/test_job_list.cpp index 79e341be615..9f0bcb378ce 100644 --- a/src/clib/old_tests/job_queue/test_job_list.cpp +++ b/src/clib/old_tests/job_queue/test_job_list.cpp @@ -1,13 +1,10 @@ -#include -#include - #include #include #include void test_create() { job_list_type *list = job_list_alloc(); - test_assert_int_equal(0, list->vec_jobs.size()); + test_assert_int_equal(0, job_list_get_size(list)); job_list_free(list); } @@ -16,8 +13,7 @@ void test_add_job() { job_queue_node_type *node = job_queue_node_alloc( "name", "/tmp", "ls", 0, stringlist_alloc_new(), 1, NULL, NULL); job_list_add_job(list, node); - list->vec_jobs.size(); - test_assert_int_equal(list->vec_jobs.size(), 1); + test_assert_int_equal(job_list_get_size(list), 1); test_assert_int_equal(job_queue_node_get_queue_index(node), 0); job_list_free(list); }