From 541e01e59ed46273000c967e5becaa9a17a52d87 Mon Sep 17 00:00:00 2001 From: Ryan Hartlage Date: Sun, 28 Jan 2024 11:32:35 -0500 Subject: [PATCH] Extract local variables for items and item_count even when there are no items --- exercises/practice/knapsack/test_knapsack.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/exercises/practice/knapsack/test_knapsack.c b/exercises/practice/knapsack/test_knapsack.c index 6b2c734a2..c9b00319e 100644 --- a/exercises/practice/knapsack/test_knapsack.c +++ b/exercises/practice/knapsack/test_knapsack.c @@ -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)