blob: 9d15cff9975a1249be8309df5b2c0077983da7e4 (
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
|
#include "config.h"
#include <idle-ctcp.h>
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include <telepathy-glib/util.h>
int
main (void)
{
gboolean fail = FALSE;
const gchar *test_str = "\001 foo \" fo bar\" bar\\001\\002\\003baz\"for every foo there is \\001 bar\\\\\001";
gchar **tokens = idle_ctcp_decode(test_str);
const gchar *should_be[] = {"foo", " fo bar", "bar\001\002\003baz", "for every foo there is \001 bar\\", NULL};
for (guint i = 0; i < (sizeof(should_be) / sizeof(should_be[0])); i++) {
if (tp_strdiff(tokens[i], should_be[i])) {
fprintf(stderr, "Should be \"%s\", is \"%s\"\n", g_strescape(should_be[i], NULL), g_strescape(tokens[i], NULL));
fail = TRUE;
}
}
if (fail)
return 1;
else
return 0;
}
|