summaryrefslogtreecommitdiff
path: root/tests/test-ctcp-kill-blingbling.c
blob: b36d6630698789373a90b4dee68b67bb56f9f18b (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
35
#include "config.h"

#include <idle-ctcp.h>

#include <stdio.h>
#include <string.h>

int
main (void)
{
	gboolean fail = FALSE;

	const gchar *test_strings[] = {
		"foobar", "foobar",
		"foo \x03\x31\x33<3", "foo <3",
		NULL, NULL
	};

	for (int i = 0; test_strings[i] != NULL; i += 2) {
		gchar *killed = idle_ctcp_kill_blingbling(test_strings[i]);

		if (strcmp(killed, test_strings[i + 1])) {
			fprintf(stderr, "\"%s\" -> \"%s\", should be \"%s\"", test_strings[i], killed, test_strings[i + 1]);
			fail = TRUE;
		}

		g_free(killed);
	}

	if (fail)
		return 1;
	else
		return 0;
}