Skip to content

Commit

Permalink
Extract local variables for items and item_count even when there are …
Browse files Browse the repository at this point in the history
…no items
  • Loading branch information
ryanplusplus committed Jan 28, 2024
1 parent 9106049 commit 541e01e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion exercises/practice/knapsack/test_knapsack.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ void tearDown(void)

static void test_no_items(void)
{
item_t *items[] = NULL;
size_t item_count = 0;
unsigned int maximum_weight = 100;

TEST_ASSERT_EQUAL_UINT(0, maximum_value(maximum_weight, NULL, 0));
TEST_ASSERT_EQUAL_UINT(0, maximum_value(maximum_weight, items, item_count));
}

static void test_one_item_too_heavy(void)
Expand Down

0 comments on commit 541e01e

Please sign in to comment.