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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <check.h>
#include "check-helpers.h"
#include "check-libempathy.h"
#include <libempathy/empathy-irc-server.h>
START_TEST (test_empathy_irc_server_new)
{
EmpathyIrcServer *server;
gchar *address;
guint port;
gboolean ssl;
server = empathy_irc_server_new ("test.localhost", 6667, TRUE);
fail_if (server == NULL);
g_object_get (server,
"address", &address,
"port", &port,
"ssl", &ssl,
NULL);
fail_if (address == NULL || strcmp (address, "test.localhost") != 0);
fail_if (port != 6667);
fail_if (!ssl);
g_free (address);
g_object_unref (server);
}
END_TEST
START_TEST (test_property_change)
{
EmpathyIrcServer *server;
gchar *address;
guint port;
gboolean ssl;
server = empathy_irc_server_new ("test.localhost", 6667, TRUE);
fail_if (server == NULL);
g_object_set (server,
"address", "test2.localhost",
"port", 6668,
"ssl", FALSE,
NULL);
g_object_get (server,
"address", &address,
"port", &port,
"ssl", &ssl,
NULL);
fail_if (address == NULL || strcmp (address, "test2.localhost") != 0);
fail_if (port != 6668);
fail_if (ssl);
g_free (address);
g_object_unref (server);
}
END_TEST
TCase *
make_empathy_irc_server_tcase (void)
{
TCase *tc = tcase_create ("empathy-irc-server");
tcase_add_test (tc, test_empathy_irc_server_new);
tcase_add_test (tc, test_property_change);
return tc;
}
|