Skip to content

Commit

Permalink
Refactor cpp driver tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andreas-el committed Sep 1, 2023
1 parent ebecd36 commit f30f6ad
Showing 1 changed file with 1 addition and 31 deletions.
32 changes: 1 addition & 31 deletions src/clib/old_tests/job_queue/test_job_queue_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,6 @@ void job_queue_set_driver_(job_driver_type driver_type) {
queue_driver_free(driver);
}

void set_option_max_running_max_running_value_set() {
queue_driver_type *driver_torque = queue_driver_alloc(TORQUE_DRIVER);
test_assert_true(queue_driver_set_option(driver_torque, MAX_RUNNING, "42"));
test_assert_string_equal("42", (const char *)queue_driver_get_option(
driver_torque, MAX_RUNNING));
queue_driver_free(driver_torque);

queue_driver_type *driver_lsf = queue_driver_alloc(LSF_DRIVER);
test_assert_true(queue_driver_set_option(driver_lsf, MAX_RUNNING, "72"));
test_assert_string_equal(
"72", (const char *)queue_driver_get_option(driver_lsf, MAX_RUNNING));
queue_driver_free(driver_lsf);
}

void set_option_max_running_max_running_option_set() {
queue_driver_type *driver_torque = queue_driver_alloc(TORQUE_DRIVER);
test_assert_true(queue_driver_set_option(driver_torque, MAX_RUNNING, "42"));
test_assert_string_equal("42", (const char *)queue_driver_get_option(
driver_torque, MAX_RUNNING));
queue_driver_free(driver_torque);
}

void set_option_invalid_option_returns_false() {
queue_driver_type *driver_torque = queue_driver_alloc(TORQUE_DRIVER);
test_assert_false(
Expand All @@ -51,7 +29,7 @@ void set_option_invalid_option_returns_false() {
void set_option_invalid_value_returns_false() {
queue_driver_type *driver_torque = queue_driver_alloc(TORQUE_DRIVER);
test_assert_false(
queue_driver_set_option(driver_torque, "MAX_RUNNING", "2a"));
queue_driver_set_option(driver_torque, TORQUE_NUM_CPUS_PER_NODE, "2a"));
queue_driver_free(driver_torque);
}

Expand All @@ -72,7 +50,6 @@ void get_driver_option_lists() {
stringlist_type *option_list = stringlist_alloc_new();
queue_driver_init_option_list(driver_torque, option_list);

test_assert_true(stringlist_contains(option_list, MAX_RUNNING));
for (const auto &i : TORQUE_DRIVER_OPTIONS) {
test_assert_true(stringlist_contains(option_list, i.c_str()));
}
Expand All @@ -86,8 +63,6 @@ void get_driver_option_lists() {
stringlist_type *option_list = stringlist_alloc_new();
queue_driver_init_option_list(driver_local, option_list);

test_assert_true(stringlist_contains(option_list, MAX_RUNNING));

stringlist_free(option_list);
queue_driver_free(driver_local);
}
Expand All @@ -98,8 +73,6 @@ void get_driver_option_lists() {
stringlist_type *option_list = stringlist_alloc_new();
queue_driver_init_option_list(driver_lsf, option_list);

test_assert_true(stringlist_contains(option_list, MAX_RUNNING));

for (const auto &i : LSF_DRIVER_OPTIONS) {
test_assert_true(stringlist_contains(option_list, i.c_str()));
}
Expand All @@ -116,7 +89,6 @@ void get_driver_option_lists() {

stringlist_fprintf(option_list, ", ", stdout);

test_assert_true(stringlist_contains(option_list, MAX_RUNNING));
for (const auto &i : SLURM_DRIVER_OPTIONS) {
test_assert_true(stringlist_contains(option_list, i.c_str()));
}
Expand All @@ -132,8 +104,6 @@ int main(int argc, char **argv) {
job_queue_set_driver_(TORQUE_DRIVER);
job_queue_set_driver_(SLURM_DRIVER);

set_option_max_running_max_running_value_set();
set_option_max_running_max_running_option_set();
set_option_invalid_option_returns_false();
set_option_invalid_value_returns_false();

Expand Down

0 comments on commit f30f6ad

Please sign in to comment.