File: tap.c

package info (click to toggle)
tofi 0.9.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,544 kB
  • sloc: ansic: 6,818; xml: 409; makefile: 8
file content (53 lines) | stat: -rw-r--r-- 833 bytes parent folder | download | duplicates (2)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

static size_t test = 0;
static char *todo = NULL;

void tap_version(size_t version)
{
	printf("TAP version %zu\n", version);
}

void tap_plan()
{
	printf("1..%zu\n", test);
}

void tap_ok(const char *message, ...)
{
	va_list args;
	va_start(args, message);
	printf("ok %zu - ", ++test);
	vprintf(message, args);
	if (todo != NULL) {
		printf(" # TODO %s", todo);
		free(todo);
		todo = NULL;
	}
	printf("\n");
	va_end(args);
}

void tap_not_ok(const char *message, ...)
{
	va_list args;
	va_start(args, message);
	printf("not ok %zu - ", ++test);
	vprintf(message, args);
	if (todo != NULL) {
		printf(" # TODO %s", todo);
		free(todo);
		todo = NULL;
	}
	printf("\n");
	va_end(args);
}

void tap_todo(const char *message)
{
	todo = strdup(message);
}