summaryrefslogtreecommitdiff
path: root/input.h
blob: 4507d088077f3b4d87d90e3cd27b6c8353e6bb40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef DEF_INPUTH
#define DEF_INPUTH

#include <stddef.h>

/* simple macro to check a result against an expected value */
#define CHECK(actual, expected) {\
	if(actual == expected)\
		printf("%ld ok\n", actual);\
	else\
		printf("%ld ko, expected %ld\n", actual, expected);\
}

struct input_int {
	size_t line_count;
	int* lines;
};

struct input_str {
	size_t line_count;
	char** lines;
};

void input_int_read(struct input_int* result, char* filename);

void input_str_read(struct input_str* result, char* filename);

void input_int_free(struct input_int* input);

void input_str_free(struct input_str* input);

char* copy_line(char* line);

#endif