Skip to content

Commit

Permalink
test: add unit test for split_string_and_push_back
Browse files Browse the repository at this point in the history
Problem: There are no unit tests for split_string_and_push_back ().

Add a unit test.
  • Loading branch information
cmoussa1 committed Feb 15, 2024
1 parent 72bb1aa commit edbe6fb
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/plugins/test/accounting_test01.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,22 @@ static void test_get_association_no_default_bank ()
}


// ensure split_string_and_push_back () works with a list of items
static void split_string_and_push_back_success ()
{
const char *assoc_queues = "bronze,silver,gold";
std::vector<std::string> expected_queues = {"bronze", "silver", "gold"};

split_string_and_push_back (assoc_queues, &users[1001]["bank_A"].queues);
ok (users[1001]["bank_A"].queues == expected_queues,
"split_string_and_push_back () works");
}


int main (int argc, char* argv[])
{
// declare the number of tests that we plan to run
plan (4);
plan (5);

// add users to the test map
initialize_map (users);
Expand All @@ -125,6 +137,7 @@ int main (int argc, char* argv[])
test_get_association_success ();
test_get_association_noexist ();
test_get_association_no_default_bank ();
split_string_and_push_back_success ();

// indicate we are done testing
done_testing ();
Expand Down

0 comments on commit edbe6fb

Please sign in to comment.