summaryrefslogtreecommitdiff
path: root/src/puzzles/puzzle.c
blob: cbad998caf2b4f00a77ecea7816d17ab22285af9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "puzzle.h"
#include <stdlib.h>
#include <string.h>

Puzzle *GetTestPuzzle() {
    Puzzle *outp = malloc(sizeof(Puzzle));
    if (outp == NULL) return NULL;

    outp->Name = strdup("Test puzzle");
    outp->Description = strdup("In this puzzle you will have to return the input string\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\n-\nThis is a line that should be somewhere down");

    return outp;
}

void FreePuzzle(Puzzle *self) {
    if (self == NULL) return;
    if (self->Name != NULL) free(self->Name);
    if (self->Description != NULL) free(self->Description);
    if (self->Tests != NULL) free(self->Tests);
    free(self);
}