Browse Source

funktion printlabyrinth erstellt

remotes/origin/Labyrinth
Ronja Awe 2 years ago
parent
commit
26229fcc6c
  1. 20
      src/c/labyrinth.c
  2. 10
      src/c/labyrinth.h
  3. 36
      test/c/test_labyrinth.c

20
src/c/labyrinth.c

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <stdbool.h>
#include "labyrinth.h"
int printlabyrinth(lab laby, int hoehe, int breite){
for(int i = 0; i < hoehe; i++){
for(int j = 0; j < breite; j++){
printf("%c ", laby[i][j]);
}
printf("\n");
}
return 0;
}

10
src/c/labyrinth.h

@ -0,0 +1,10 @@
#ifndef LABYRINTH_H
#define LABYRINTH_H
#define MAXZEILEN 5
#define MAXSPALTEN 5
typedef char lab[MAXZEILEN][MAXSPALTEN];
int printlabyrinth(lab laby, int hoehe, int breite);
#endif

36
test/c/test_labyrinth.c

@ -0,0 +1,36 @@
#ifdef TEST
#include "unity.h"
//in example.h wird die Funktion deklariert
#include "labyrinth.h"
//Vor- bzw. Nachbereitung
void setUp(void)
{
}
void tearDown(void)
{
}
void test_runExampleTest(void)
{
int result;
int input = 1;
int hoehe = 3;
int breite = 3;
lab laby = {
{'1', '2', '3'},
{'4', '5', '6'},
{'7', '8', '9'},
};
result = printlabyrinth(laby, hoehe, breite);
TEST_ASSERT_EQUAL_INT(0, result);
}
#endif // TEST
Loading…
Cancel
Save