Skip to content

Commit

Permalink
fixup! Inline job_list_reset and remove job_list_get_size
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Sep 18, 2023
1 parent da06706 commit 586b637
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/clib/lib/include/ert/job_queue/job_list.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions src/clib/lib/job_queue/job_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions src/clib/old_tests/job_queue/test_job_list.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include <stdbool.h>
#include <stdlib.h>

#include <ert/job_queue/job_list.hpp>
#include <ert/job_queue/job_node.hpp>
#include <ert/util/test_util.hpp>

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);
}

Expand All @@ -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);
}
Expand Down

0 comments on commit 586b637

Please sign in to comment.