added more unit tests for test_stack.c
This commit is contained in:
parent
204f2a2526
commit
64a16f06d7
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