diff --git a/numbers.c b/numbers.c index f59d9a2..61fa7cc 100644 --- a/numbers.c +++ b/numbers.c @@ -14,7 +14,7 @@ // Returns len random numbers between 1 and 2x len in random order which are all different, except for two entries. // Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while // creating random numbers. -unsigned int *createNumbers(unsigned int len) +unsigned int* createNumbers(unsigned int len) { } diff --git a/stackTests b/stackTests index be175e3..b799152 100644 Binary files a/stackTests and b/stackTests differ diff --git a/test_stack.c b/test_stack.c index 9b77f35..90bf120 100644 --- a/test_stack.c +++ b/test_stack.c @@ -37,6 +37,18 @@ void test_topReturnsCorrectValue(void) { clearStack(startNode); } +void test_topReturnsNullOnNotExistingStack(void) { + // 1. Arrange + StackNode* startNode = NULL; + int* data; + + // 2. Act + data = top(startNode); + + //3. Assert + TEST_ASSERT_NULL(data); +} + void test_popRemovesElements(void) { // 1. Arrange StackNode* startNode = NULL; @@ -70,6 +82,7 @@ int main(void) { printf("\n============================\nStack tests\n============================\n"); + RUN_TEST(test_topReturnsNullOnNotExistingStack); RUN_TEST(test_topReturnsCorrectValue); RUN_TEST(test_popRemovesElements);