This commit is contained in:
Niklas Popp 2025-12-10 21:02:55 +01:00
parent a6996b4d35
commit 7f1c02d1c2

37
doblespiel/test_stack.c Normal file
View File

@ -0,0 +1,37 @@
#include <stdio.h>
#include <stdlib.h>
#include "stack.h"
int draufundentfernen(StackNode *stack){
//erst ein paar stacks drauf oben
int i = 3;
int j = 8;
int m = 2;
push(stack, i);
if (top(stack) !=i)
{printf("Fehler");}
push(stack, j);
if (top(stack) !=j)
{printf("Fehler");}
push(stack, m);
if (top(stack) !=m)
{printf("Fehler");}
if (top(stack) ==j)
{printf("auf stack hat geklappt");
}
//dann alle wieder entfernen
pop(stack);
if (top(stack) !=j)
{printf("Fehler");}
pop(stack);
if (top(stack) !=m)
{printf("Fehler");}
pop(stack);
if (top(stack) !=i)
{printf("Fehler");}
printf("Drauf und runter funtkioniert!");
}