generated from freudenreichan/info2Praktikum-DobleSpiel
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6de4670e6 | ||
|
|
3240c51876 | ||
|
|
9437f26146 | ||
|
|
41e01c3af3 |
Vendored
-18
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "windows-gcc-x64",
|
|
||||||
"includePath": [
|
|
||||||
"${workspaceFolder}/**"
|
|
||||||
],
|
|
||||||
"compilerPath": "C:/ProgramData/mingw64/mingw64/bin/gcc.exe",
|
|
||||||
"cStandard": "${default}",
|
|
||||||
"cppStandard": "${default}",
|
|
||||||
"intelliSenseMode": "windows-gcc-x64",
|
|
||||||
"compilerArgs": [
|
|
||||||
""
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": 4
|
|
||||||
}
|
|
||||||
Vendored
-24
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "C/C++ Runner: Debug Session",
|
|
||||||
"type": "cppdbg",
|
|
||||||
"request": "launch",
|
|
||||||
"args": [],
|
|
||||||
"stopAtEntry": false,
|
|
||||||
"externalConsole": true,
|
|
||||||
"cwd": "e:/Informatik/Drittes Projekt/DobleSpiel",
|
|
||||||
"program": "e:/Informatik/Drittes Projekt/DobleSpiel/build/Debug/outDebug",
|
|
||||||
"MIMode": "gdb",
|
|
||||||
"miDebuggerPath": "gdb",
|
|
||||||
"setupCommands": [
|
|
||||||
{
|
|
||||||
"description": "Enable pretty-printing for gdb",
|
|
||||||
"text": "-enable-pretty-printing",
|
|
||||||
"ignoreFailures": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
Vendored
-59
@@ -1,59 +0,0 @@
|
|||||||
{
|
|
||||||
"C_Cpp_Runner.cCompilerPath": "gcc",
|
|
||||||
"C_Cpp_Runner.cppCompilerPath": "g++",
|
|
||||||
"C_Cpp_Runner.debuggerPath": "gdb",
|
|
||||||
"C_Cpp_Runner.cStandard": "",
|
|
||||||
"C_Cpp_Runner.cppStandard": "",
|
|
||||||
"C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat",
|
|
||||||
"C_Cpp_Runner.useMsvc": false,
|
|
||||||
"C_Cpp_Runner.warnings": [
|
|
||||||
"-Wall",
|
|
||||||
"-Wextra",
|
|
||||||
"-Wpedantic",
|
|
||||||
"-Wshadow",
|
|
||||||
"-Wformat=2",
|
|
||||||
"-Wcast-align",
|
|
||||||
"-Wconversion",
|
|
||||||
"-Wsign-conversion",
|
|
||||||
"-Wnull-dereference"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.msvcWarnings": [
|
|
||||||
"/W4",
|
|
||||||
"/permissive-",
|
|
||||||
"/w14242",
|
|
||||||
"/w14287",
|
|
||||||
"/w14296",
|
|
||||||
"/w14311",
|
|
||||||
"/w14826",
|
|
||||||
"/w44062",
|
|
||||||
"/w44242",
|
|
||||||
"/w14905",
|
|
||||||
"/w14906",
|
|
||||||
"/w14263",
|
|
||||||
"/w44265",
|
|
||||||
"/w14928"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.enableWarnings": true,
|
|
||||||
"C_Cpp_Runner.warningsAsError": false,
|
|
||||||
"C_Cpp_Runner.compilerArgs": [],
|
|
||||||
"C_Cpp_Runner.linkerArgs": [],
|
|
||||||
"C_Cpp_Runner.includePaths": [],
|
|
||||||
"C_Cpp_Runner.includeSearch": [
|
|
||||||
"*",
|
|
||||||
"**/*"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.excludeSearch": [
|
|
||||||
"**/build",
|
|
||||||
"**/build/**",
|
|
||||||
"**/.*",
|
|
||||||
"**/.*/**",
|
|
||||||
"**/.vscode",
|
|
||||||
"**/.vscode/**"
|
|
||||||
],
|
|
||||||
"C_Cpp_Runner.useAddressSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useUndefinedSanitizer": false,
|
|
||||||
"C_Cpp_Runner.useLeakSanitizer": false,
|
|
||||||
"C_Cpp_Runner.showCompilationTime": false,
|
|
||||||
"C_Cpp_Runner.useLinkTimeOptimization": false,
|
|
||||||
"C_Cpp_Runner.msvcSecureNoWarnings": false
|
|
||||||
}
|
|
||||||
@@ -8,61 +8,26 @@
|
|||||||
* `treeSize`: zählt die Knoten im Baum (rekursiv),
|
* `treeSize`: zählt die Knoten im Baum (rekursiv),
|
||||||
* `nextTreeData`: Traversierung mit Hilfe des zuvor implementierten Stacks. */
|
* `nextTreeData`: Traversierung mit Hilfe des zuvor implementierten Stacks. */
|
||||||
|
|
||||||
|
|
||||||
static StackNode *stack = NULL;
|
|
||||||
|
|
||||||
TreeNode* createNode (const void* data, size_t dataSize){
|
|
||||||
|
|
||||||
TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));
|
|
||||||
if (newNode == NULL){
|
|
||||||
// Fehlerbehandlung
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
newNode->data = malloc(dataSize);
|
|
||||||
if(newNode->data == NULL){
|
|
||||||
free(newNode); // newNode freigeben
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy (newNode->data, data, dataSize);
|
|
||||||
|
|
||||||
newNode->left = NULL;
|
|
||||||
newNode->right = NULL;
|
|
||||||
return newNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adds a copy of data's pointer destination to the tree using compareFct for ordering. Accepts duplicates
|
// Adds a copy of data's pointer destination to the tree using compareFct for ordering. Accepts duplicates
|
||||||
// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added).
|
// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added).
|
||||||
TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate)
|
TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate)
|
||||||
{
|
{
|
||||||
if (root == NULL)
|
if(root == NULL){
|
||||||
{
|
TreeNode *node;
|
||||||
TreeNode *newNode = createNode(data,dataSize);
|
node = (TreeNode*)malloc(sizeof(TreeNode));
|
||||||
if (isDuplicate != NULL)
|
if(node == NULL){
|
||||||
*isDuplicate = 0;
|
return NULL;
|
||||||
|
}
|
||||||
return newNode;
|
node->data = malloc(dataSize);
|
||||||
}
|
if(node->data == NULL){
|
||||||
if (compareFct(root->data, data)==0)
|
free(node);
|
||||||
{
|
return NULL;
|
||||||
if (isDuplicate != NULL) {
|
}
|
||||||
*isDuplicate=1;
|
memcpy(node->data, data, dataSize);
|
||||||
return root;
|
node->left;
|
||||||
}
|
node->right;
|
||||||
TreeNode *newNode = createNode(data,dataSize);
|
|
||||||
return newNode;
|
|
||||||
}
|
|
||||||
else if (compareFct(root->data, data)>0)
|
|
||||||
{
|
|
||||||
root->left = addToTree(root->left, data, dataSize, compareFct, isDuplicate);
|
|
||||||
}
|
|
||||||
else if (compareFct(root->data, data)<0)
|
|
||||||
{
|
|
||||||
root->right= addToTree(root->right, data, dataSize, compareFct, isDuplicate);
|
|
||||||
}
|
|
||||||
return root;
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterates over the tree given by root. Follows the usage of strtok. If tree is NULL, the next entry of the last tree given is returned in ordering direction.
|
// Iterates over the tree given by root. Follows the usage of strtok. If tree is NULL, the next entry of the last tree given is returned in ordering direction.
|
||||||
@@ -70,45 +35,17 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFc
|
|||||||
// push the top node and push all its left nodes.
|
// push the top node and push all its left nodes.
|
||||||
void *nextTreeData(TreeNode *root)
|
void *nextTreeData(TreeNode *root)
|
||||||
{
|
{
|
||||||
if (root != NULL) {
|
|
||||||
clearStack(stack);
|
|
||||||
stack = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Releases all memory resources (including data copies).
|
// Releases all memory resources (including data copies).
|
||||||
void clearTree(TreeNode *root)
|
void clearTree(TreeNode *root)
|
||||||
{
|
{
|
||||||
if (root != NULL) {
|
|
||||||
if (root->left != NULL) {
|
|
||||||
clearTree(root->left);
|
|
||||||
}
|
|
||||||
if (root->right != NULL) {
|
|
||||||
clearTree(root->right);
|
|
||||||
}
|
|
||||||
free(root->data);
|
|
||||||
free(root);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of entries in the tree given by root.
|
// Returns the number of entries in the tree given by root.
|
||||||
unsigned int treeSize(const TreeNode *root)
|
unsigned int treeSize(const TreeNode *root)
|
||||||
{
|
{
|
||||||
unsigned int size = 0;
|
|
||||||
if (root == NULL) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (root->left != NULL)
|
|
||||||
{
|
|
||||||
size += treeSize(root->left);
|
|
||||||
}
|
|
||||||
if (root->right != NULL)
|
|
||||||
{
|
|
||||||
size += treeSize(root->right);
|
|
||||||
}
|
|
||||||
return size+1;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -1,4 +1 @@
|
|||||||
Moritz1;9970
|
|
||||||
Moritz;9954
|
|
||||||
Moritz;4986
|
|
||||||
player1;3999
|
player1;3999
|
||||||
|
|||||||
@@ -35,8 +35,20 @@ $(program_obj_filesobj_files): %.o: %.c
|
|||||||
# --------------------------
|
# --------------------------
|
||||||
# Unit Tests
|
# Unit Tests
|
||||||
# --------------------------
|
# --------------------------
|
||||||
unitTests:
|
unitTests: stacktest
|
||||||
echo "needs to be implemented"
|
|
||||||
|
|
||||||
|
test_stack: stacktest.o stack.o
|
||||||
|
$(CC) $(FLAGS) $^ -o stacktest
|
||||||
|
|
||||||
|
test_numbers: numberstest.o numbers.o
|
||||||
|
$(CC) $(FLAGS) $^ -o numberstest
|
||||||
|
|
||||||
|
test_stack.o: stacktest.c
|
||||||
|
$(CC) -c $(FLAGS) $< -o $@
|
||||||
|
|
||||||
|
test_numbers.o: numberstest.c
|
||||||
|
$(CC) -c $(FLAGS) $< -o $@
|
||||||
|
|
||||||
# --------------------------
|
# --------------------------
|
||||||
# Clean
|
# Clean
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -14,13 +15,69 @@
|
|||||||
// Returns len random numbers between 1 and 2x len in random order which are all different, except for two entries.
|
// 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
|
// Returns NULL on errors. Use your implementation of the binary search tree to check for possible duplicates while
|
||||||
// creating random numbers.
|
// creating random numbers.
|
||||||
|
|
||||||
|
int compare(const void* a, const void* b) {
|
||||||
|
return (*(unsigned int*)a - *(unsigned int*)b);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int *createNumbers(unsigned int len)
|
unsigned int *createNumbers(unsigned int len)
|
||||||
{
|
{
|
||||||
|
//array erstellen
|
||||||
|
if(len < 2)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
unsigned int *arr = malloc(sizeof(unsigned int)*len);
|
||||||
|
|
||||||
|
//sicherstellen dass zahlen einmalig vorkommen
|
||||||
|
srand(time(NULL));
|
||||||
|
for(int i = 0; i < len; i++){
|
||||||
|
while(1){
|
||||||
|
unsigned int value = (rand() % (2 * len)) + 1;
|
||||||
|
int alreadyUsed = 0;
|
||||||
|
for(int j = 0; j < i; j++) {
|
||||||
|
if(arr[j] == value) {
|
||||||
|
alreadyUsed = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!alreadyUsed) {
|
||||||
|
arr[i] = value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//eine zahl duplizieren und irgendwo hinkopieren
|
||||||
|
int dupIndex = rand() % len;
|
||||||
|
int targetIndex;
|
||||||
|
do{
|
||||||
|
targetIndex = rand() % len;
|
||||||
|
}while (targetIndex == dupIndex);
|
||||||
|
arr[targetIndex] = arr[dupIndex];
|
||||||
|
|
||||||
|
return arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns only the only number in numbers which is present twice. Returns zero on errors.
|
// Returns only the only number in numbers which is present twice. Returns zero on errors.
|
||||||
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
|
unsigned int getDuplicate(const unsigned int numbers[], unsigned int len)
|
||||||
{
|
{
|
||||||
|
if(len < 2){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int *copy = malloc(sizeof(unsigned int)*len);
|
||||||
|
|
||||||
|
memcpy(copy, numbers, len * sizeof(unsigned int));
|
||||||
|
|
||||||
|
qsort(copy, len, sizeof(unsigned int), compare);
|
||||||
|
|
||||||
|
unsigned int duplicate = 0;
|
||||||
|
for(int i = 1; i < len; i++){
|
||||||
|
if(copy[i] == copy[i-1]){
|
||||||
|
duplicate = copy[i];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
free(copy);
|
||||||
|
return duplicate;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include "numbers.h"
|
||||||
|
|
||||||
|
//Funktion, um nachzuprüfen, ob Test bestanden wurde
|
||||||
|
void check(char *msg, int expected, int actual){
|
||||||
|
printf("%s: ", msg);
|
||||||
|
printf("Erwartet: %d, Tatsächlich: %d\n", expected, actual);
|
||||||
|
if(expected == actual){
|
||||||
|
printf("Test bestanden\n");
|
||||||
|
}else{
|
||||||
|
printf("Test nicht bestanden\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
//prüfen, ob len < 2 NULL zurückgibt
|
||||||
|
unsigned int *numbers = createNumbers(1);
|
||||||
|
check("createNumbers mit len < 2", 1, numbers == NULL);
|
||||||
|
if(numbers != NULL){
|
||||||
|
free(numbers);
|
||||||
|
}
|
||||||
|
//prüfen, ob len = 10 ein Array zurückgibt
|
||||||
|
int len = 10;
|
||||||
|
numbers = createNumbers(len);
|
||||||
|
check("createNumbers mit len = 10", 1, numbers != NULL);
|
||||||
|
//prüfen, ob alle Zahlen zwischen 1 und 2*len liegen
|
||||||
|
int OK = 1;
|
||||||
|
for(int i = 0; i < len; i++){
|
||||||
|
if(numbers[i] < 1 || numbers[i] > 2*len){
|
||||||
|
OK = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check("Zahlenbereich bei createNumbers", 1, OK);
|
||||||
|
//prüfen, ob genau eine Zahl doppelt vorkommt
|
||||||
|
int duplikat = 0;
|
||||||
|
for(int i = 0; i < len; i++){
|
||||||
|
for(int j = i+1; j < len; j++){
|
||||||
|
if(numbers[i] == numbers[j]){
|
||||||
|
duplikat++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
check("Genau ein Duplikat bei createNumbers", 1, duplikat == 1);
|
||||||
|
free(numbers);
|
||||||
|
|
||||||
|
//Tests getDuplicate
|
||||||
|
int testArray1[] = {1,2,3,4,5,5,6,7,8,9};
|
||||||
|
int result = getDuplicate(testArray1, 10);
|
||||||
|
check("getDuplicate Test 1", 5, result);
|
||||||
|
int testArray2[] = {10,20,30,40,50,60,70,80,90,90};
|
||||||
|
result = getDuplicate(testArray2, 10);
|
||||||
|
check("getDuplicate Test 2", 90, result);
|
||||||
|
//prüfen bei ungültiger länge
|
||||||
|
result = getDuplicate(testArray2, 1);
|
||||||
|
check("getDuplicate mit len < 2", 0, result);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
@@ -8,26 +8,52 @@
|
|||||||
* `clearStack`: gibt den gesamten Speicher frei. */
|
* `clearStack`: gibt den gesamten Speicher frei. */
|
||||||
|
|
||||||
// Pushes data as pointer onto the stack.
|
// Pushes data as pointer onto the stack.
|
||||||
|
|
||||||
|
|
||||||
StackNode *push(StackNode *stack, void *data)
|
StackNode *push(StackNode *stack, void *data)
|
||||||
{
|
{
|
||||||
|
//Neue Node wird erstellt, Speicher wird zugewiesen
|
||||||
|
StackNode *newNode = (StackNode *)malloc(sizeof(StackNode));
|
||||||
|
if (newNode == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
//Data und der zeiger auf den nächsten Node werden zugewiesen
|
||||||
|
newNode->data = data;
|
||||||
|
newNode->next = stack;
|
||||||
|
return newNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes the top element of the stack (latest added element) and releases its memory. (Pointer to data has to be
|
// Deletes the top element of the stack (latest added element) and releases its memory. (Pointer to data has to be
|
||||||
// freed by caller.)
|
// freed by caller.)
|
||||||
StackNode *pop(StackNode *stack)
|
StackNode *pop(StackNode *stack)
|
||||||
{
|
{
|
||||||
|
//Wenn Stack leer, wird NULL zurückgegeben
|
||||||
|
if(stack == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
//Nächster Node wird gespeichert, aktuellerr Node wird freigegeben
|
||||||
|
StackNode *next = stack->next;
|
||||||
|
free(stack);
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the data of the top element.
|
// Returns the data of the top element.
|
||||||
void *top(StackNode *stack)
|
void *top(StackNode *stack)
|
||||||
{
|
{
|
||||||
|
if(stack == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return stack->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clears stack and releases all memory.
|
// Clears stack and releases all memory.
|
||||||
void clearStack(StackNode *stack)
|
void clearStack(StackNode *stack)
|
||||||
{
|
{
|
||||||
|
//Speichert den aktuellen Node, freed ihn dann und geht zum nächsten
|
||||||
|
StackNode *temp;
|
||||||
|
while(stack != NULL) {
|
||||||
|
temp = stack;
|
||||||
|
stack = stack->next;
|
||||||
|
free(temp);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -8,11 +8,12 @@ The latest element is taken from the stack. */
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
//TODO: passenden Datentyp als struct anlegen
|
//TODO: passenden Datentyp als struct anlegen
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
void *data;
|
void *data;
|
||||||
}StackNode;
|
struct StackNode *next;
|
||||||
|
|
||||||
|
|
||||||
|
}StackNode;
|
||||||
// Pushes data as pointer onto the stack.
|
// Pushes data as pointer onto the stack.
|
||||||
StackNode *push(StackNode *stack, void *data);
|
StackNode *push(StackNode *stack, void *data);
|
||||||
|
|
||||||
|
|||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include "stack.h"
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
//Funktion, um nachzuprüfen, ob Test bestanden wurde
|
||||||
|
void check(char *msg, int expected, int actual){
|
||||||
|
printf("%s: ", msg);
|
||||||
|
printf("Erwartet: %d, Tatsächlich: %d\n", expected, actual);
|
||||||
|
if(expected == actual){
|
||||||
|
printf("Test bestanden\n");
|
||||||
|
}else{
|
||||||
|
printf("Test nicht bestanden\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Schnappt sich oberstes Element
|
||||||
|
int getTop(StackNode *stack){
|
||||||
|
void *data = top(stack);
|
||||||
|
return(int)data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tests der einzelnen Stackfunktionen
|
||||||
|
int main(){
|
||||||
|
StackNode *stack = NULL;
|
||||||
|
//Test push
|
||||||
|
|
||||||
|
stack = push(stack, (void*)10);
|
||||||
|
check("Nach Push 10", 10, getTop(stack));
|
||||||
|
|
||||||
|
stack = push(stack, (void*)20);
|
||||||
|
check("Nach Push 20", 20, getTop(stack));
|
||||||
|
|
||||||
|
//pop testen
|
||||||
|
stack = pop(stack);
|
||||||
|
check("Nach Pop", 10, getTop(stack));
|
||||||
|
|
||||||
|
//clearStack testen
|
||||||
|
clearStack(stack);
|
||||||
|
stack = NULL;
|
||||||
|
check("Nach ClearStack", 0, getTop(stack));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user