aboutsummaryrefslogtreecommitdiff
path: root/src/unit-test.c
blob: 2e942a003763ee0804a48da38bca12d6bf9d105e (plain) (blame)
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
#ifndef UNIT_TEST_H
#define UNIT_TEST_H

#include "unit-test.h"
#include <stdio.h>
#include <assert.h>

#define COLOUR_RESET  "\033[0m"
#define COLOUR_RED    "\033[0;31m"
#define COLOUR_GREEN  "\033[0;32m"
#define COLOUR_YELLOW "\033[0;33m"

void test_start(const char *const name) {
	assert(fprintf(stderr, "%s():\n", name) > 0);
}

void testing(const char *const message) {
	assert(
		fprintf(
			stderr,
			COLOUR_YELLOW "testing" COLOUR_RESET ": %s...",
			message
		) > 0
	);
}

void test_ok() {
	assert(fprintf(stderr, " " COLOUR_GREEN "OK" COLOUR_RESET ".\n") > 0);
}

#endif