added more unit tests for test_stack.c
This commit is contained in:
parent
204f2a2526
commit
64a16f06d7
@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BIN
stackTests
BIN
stackTests
Binary file not shown.
13
test_stack.c
13
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);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user