Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 733708
Collapse All | Expand All

(-)a/tests/s-common-address.c (-22 / +22 lines)
Lines 49-59 setup (void) Link Here
49
        s_in->sin_addr.s_addr = htonl (INADDR_LOOPBACK);
49
        s_in->sin_addr.s_addr = htonl (INADDR_LOOPBACK);
50
50
51
        ga = gdm_address_new_from_sockaddr (&sa, sizeof (sa));
51
        ga = gdm_address_new_from_sockaddr (&sa, sizeof (sa));
52
        fail_unless (NULL != ga);
52
        ck_assert (NULL != ga);
53
53
54
        s_in->sin_addr.s_addr = htonl (0xc0a80001); /* 192.168.0.1 */
54
        s_in->sin_addr.s_addr = htonl (0xc0a80001); /* 192.168.0.1 */
55
        ga192 = gdm_address_new_from_sockaddr (&sa, sizeof (sa));
55
        ga192 = gdm_address_new_from_sockaddr (&sa, sizeof (sa));
56
        fail_unless (NULL != (ga192));
56
        ck_assert (NULL != (ga192));
57
57
58
#ifdef ENABLE_IPV6
58
#ifdef ENABLE_IPV6
59
        s_in6 = (struct sockaddr_in6 *) &sa6;
59
        s_in6 = (struct sockaddr_in6 *) &sa6;
Lines 61-67 setup (void) Link Here
61
        s_in6->sin6_port = htons (25);
61
        s_in6->sin6_port = htons (25);
62
        s_in6->sin6_addr = in6addr_loopback;
62
        s_in6->sin6_addr = in6addr_loopback;
63
        ga6 = gdm_address_new_from_sockaddr ((struct sockaddr*)&sa6, sizeof(sa6));
63
        ga6 = gdm_address_new_from_sockaddr ((struct sockaddr*)&sa6, sizeof(sa6));
64
        fail_unless (NULL != ga6);
64
        ck_assert (NULL != ga6);
65
#endif
65
#endif
66
}
66
}
67
67
Lines 97-115 START_TEST (test_gdm_address_new_from_sockaddr) Link Here
97
#endif
97
#endif
98
98
99
        _ga = gdm_address_new_from_sockaddr ((struct sockaddr *) &sa, sizeof (sa));
99
        _ga = gdm_address_new_from_sockaddr ((struct sockaddr *) &sa, sizeof (sa));
100
        fail_unless (NULL != _ga);
100
        ck_assert (NULL != _ga);
101
        gdm_address_free (_ga);
101
        gdm_address_free (_ga);
102
102
103
#ifdef ENABLE_IPV6
103
#ifdef ENABLE_IPV6
104
        _ga6 = gdm_address_new_from_sockaddr((struct sockaddr *) &sa6, sizeof (sa6));
104
        _ga6 = gdm_address_new_from_sockaddr((struct sockaddr *) &sa6, sizeof (sa6));
105
        fail_unless (NULL != _ga6);
105
        ck_assert (NULL != _ga6);
106
        gdm_address_free (_ga6);
106
        gdm_address_free (_ga6);
107
#endif
107
#endif
108
108
109
#ifndef NO_INVALID_INPUT
109
#ifndef NO_INVALID_INPUT
110
        /* invalid input */
110
        /* invalid input */
111
        fail_unless (NULL == gdm_address_new_from_sockaddr ((struct sockaddr *) &sa, 1), NULL );
111
        ck_assert_msg (NULL == gdm_address_new_from_sockaddr ((struct sockaddr *) &sa, 1), NULL );
112
        fail_unless (NULL == gdm_address_new_from_sockaddr (NULL, 0), NULL);
112
        ck_assert_msg (NULL == gdm_address_new_from_sockaddr (NULL, 0), NULL);
113
#endif
113
#endif
114
}
114
}
115
END_TEST
115
END_TEST
Lines 117-131 END_TEST Link Here
117
117
118
START_TEST (test_gdm_address_get_family_type)
118
START_TEST (test_gdm_address_get_family_type)
119
{
119
{
120
        fail_unless (AF_INET == gdm_address_get_family_type (ga), NULL);
120
        ck_assert_msg (AF_INET == gdm_address_get_family_type (ga), NULL);
121
121
122
#ifdef ENABLE_IPV6
122
#ifdef ENABLE_IPV6
123
        fail_unless (AF_INET6 == gdm_address_get_family_type (ga6), NULL);
123
        ck_assert_msg (AF_INET6 == gdm_address_get_family_type (ga6), NULL);
124
#endif
124
#endif
125
125
126
#ifndef NO_INVALID_INPUT
126
#ifndef NO_INVALID_INPUT
127
        /* invalid input */
127
        /* invalid input */
128
        fail_unless (-1 == gdm_address_get_family_type (NULL), NULL);
128
        ck_assert_msg (-1 == gdm_address_get_family_type (NULL), NULL);
129
#endif
129
#endif
130
130
131
}
131
}
Lines 134-150 END_TEST Link Here
134
134
135
START_TEST (test_gdm_address_is_loopback)
135
START_TEST (test_gdm_address_is_loopback)
136
{
136
{
137
        fail_unless (TRUE == gdm_address_is_loopback (ga));
137
        ck_assert (TRUE == gdm_address_is_loopback (ga));
138
        fail_unless (FALSE == gdm_address_is_loopback (ga192));
138
        ck_assert (FALSE == gdm_address_is_loopback (ga192));
139
139
140
#ifdef ENABLE_IPV6
140
#ifdef ENABLE_IPV6
141
        fail_unless (TRUE == gdm_address_is_loopback (ga6));
141
        ck_assert (TRUE == gdm_address_is_loopback (ga6));
142
        /* FIXME: add more addresses */
142
        /* FIXME: add more addresses */
143
#endif
143
#endif
144
144
145
#ifndef NO_INVALID_INPUT
145
#ifndef NO_INVALID_INPUT
146
        /* invalid input */
146
        /* invalid input */
147
        fail_unless (FALSE == gdm_address_is_loopback (NULL));
147
        ck_assert (FALSE == gdm_address_is_loopback (NULL));
148
#endif
148
#endif
149
}
149
}
150
END_TEST
150
END_TEST
Lines 161-178 START_TEST (test_gdm_address_equal) Link Here
161
        sin1->sin_family = AF_INET;
161
        sin1->sin_family = AF_INET;
162
        sin1->sin_addr.s_addr = htonl (0xc0a80001); /* 192.168.0.1 */
162
        sin1->sin_addr.s_addr = htonl (0xc0a80001); /* 192.168.0.1 */
163
        gdm1 = gdm_address_new_from_sockaddr (&sa1, sizeof (sa1));
163
        gdm1 = gdm_address_new_from_sockaddr (&sa1, sizeof (sa1));
164
        fail_unless (gdm_address_equal (ga, ga192) == FALSE, NULL);
164
        ck_assert_msg (gdm_address_equal (ga, ga192) == FALSE, NULL);
165
165
166
        /* should be equal */
166
        /* should be equal */
167
        fail_unless (TRUE == gdm_address_equal (ga192, gdm1), NULL);
167
        ck_assert_msg (TRUE == gdm_address_equal (ga192, gdm1), NULL);
168
168
169
        gdm_address_free (gdm1);
169
        gdm_address_free (gdm1);
170
170
171
#ifdef ENABLE_IPV6
171
#ifdef ENABLE_IPV6
172
        /* should be inequal */
172
        /* should be inequal */
173
        fail_unless (FALSE == gdm_address_equal (ga6, ga), NULL);
173
        ck_assert_msg (FALSE == gdm_address_equal (ga6, ga), NULL);
174
        fail_unless (FALSE == gdm_address_equal (ga6, ga192), NULL);
174
        ck_assert_msg (FALSE == gdm_address_equal (ga6, ga192), NULL);
175
        fail_unless (FALSE == gdm_address_equal (ga6, gdm1), NULL);
175
        ck_assert_msg (FALSE == gdm_address_equal (ga6, gdm1), NULL);
176
176
177
        /* should be equal */
177
        /* should be equal */
178
        /* FIXME: ipv6 version too */
178
        /* FIXME: ipv6 version too */
Lines 180-188 START_TEST (test_gdm_address_equal) Link Here
180
180
181
#ifndef NO_INVALID_INPUT
181
#ifndef NO_INVALID_INPUT
182
        /* invalid input */
182
        /* invalid input */
183
        fail_unless (FALSE == gdm_address_equal (NULL, NULL), NULL);
183
        ck_assert_msg (FALSE == gdm_address_equal (NULL, NULL), NULL);
184
        fail_unless (FALSE == gdm_address_equal (ga, NULL), NULL);
184
        ck_assert_msg (FALSE == gdm_address_equal (ga, NULL), NULL);
185
        fail_unless (FALSE == gdm_address_equal (NULL, ga), NULL);
185
        ck_assert_msg (FALSE == gdm_address_equal (NULL, ga), NULL);
186
#endif
186
#endif
187
}
187
}
188
END_TEST
188
END_TEST
(-)a/tests/s-common.c (-30 / +30 lines)
Lines 60-95 static gboolean expands_to (const char *to_expand, const char *expanded) Link Here
60
60
61
START_TEST (test_gdm_shell_expand)
61
START_TEST (test_gdm_shell_expand)
62
{
62
{
63
        fail_unless (expands_to ("foo", "foo"));
63
        ck_assert (expands_to ("foo", "foo"));
64
        fail_unless (expands_to ("foo ", "foo "));
64
        ck_assert (expands_to ("foo ", "foo "));
65
        fail_unless (expands_to ("foo#bar", "foo#bar"));
65
        ck_assert (expands_to ("foo#bar", "foo#bar"));
66
        fail_unless (expands_to ("foo #bar", "foo "));
66
        ck_assert (expands_to ("foo #bar", "foo "));
67
        fail_unless (expands_to ("#bar", ""));
67
        ck_assert (expands_to ("#bar", ""));
68
        fail_unless (expands_to ("foo #bar gazonk", "foo "));
68
        ck_assert (expands_to ("foo #bar gazonk", "foo "));
69
        fail_unless (expands_to ("foo #bar gazonk", "foo "));
69
        ck_assert (expands_to ("foo #bar gazonk", "foo "));
70
        fail_unless (expands_to ("foo #bar gazonk", "foo "));
70
        ck_assert (expands_to ("foo #bar gazonk", "foo "));
71
        fail_unless (expands_to ("$FOO", "BAR"));
71
        ck_assert (expands_to ("$FOO", "BAR"));
72
        fail_unless (expands_to ("$9FOO", "$9FOO"));
72
        ck_assert (expands_to ("$9FOO", "$9FOO"));
73
        fail_unless (expands_to ("$FOO9", "XXX"));
73
        ck_assert (expands_to ("$FOO9", "XXX"));
74
        fail_unless (expands_to ("${FOO}9", "BAR9"));
74
        ck_assert (expands_to ("${FOO}9", "BAR9"));
75
        fail_unless (expands_to ("$_FOO", "YYY"));
75
        ck_assert (expands_to ("$_FOO", "YYY"));
76
        fail_unless (expands_to ("$FOO_FOO", "ZZZ"));
76
        ck_assert (expands_to ("$FOO_FOO", "ZZZ"));
77
        fail_unless (expands_to ("${FOO}", "BAR"));
77
        ck_assert (expands_to ("${FOO}", "BAR"));
78
        fail_unless (expands_to ("$FOO$FOO", "BARBAR"));
78
        ck_assert (expands_to ("$FOO$FOO", "BARBAR"));
79
        fail_unless (expands_to ("${FOO}${FOO}", "BARBAR"));
79
        ck_assert (expands_to ("${FOO}${FOO}", "BARBAR"));
80
        fail_unless (expands_to ("$FOO${FOO}", "BARBAR"));
80
        ck_assert (expands_to ("$FOO${FOO}", "BARBAR"));
81
        fail_unless (expands_to ("$foo", ""));
81
        ck_assert (expands_to ("$foo", ""));
82
        fail_unless (expands_to ("$FOOBAR", ""));
82
        ck_assert (expands_to ("$FOOBAR", ""));
83
        fail_unless (expands_to ("$FOO/BAR", "BAR/BAR"));
83
        ck_assert (expands_to ("$FOO/BAR", "BAR/BAR"));
84
        fail_unless (expands_to ("${FOO}BAR", "BARBAR"));
84
        ck_assert (expands_to ("${FOO}BAR", "BARBAR"));
85
        fail_unless (expands_to ("$/BAR", "$/BAR"));
85
        ck_assert (expands_to ("$/BAR", "$/BAR"));
86
        fail_unless (expands_to ("${FOO BAR}BAR", "${FOO BAR}BAR"));
86
        ck_assert (expands_to ("${FOO BAR}BAR", "${FOO BAR}BAR"));
87
        fail_unless (expands_to ("${}BAR", "${}BAR"));
87
        ck_assert (expands_to ("${}BAR", "${}BAR"));
88
        fail_unless (expands_to ("${$FOO}BAR", "${BAR}BAR"));
88
        ck_assert (expands_to ("${$FOO}BAR", "${BAR}BAR"));
89
        fail_unless (expands_to ("\\$foo", "$foo"));
89
        ck_assert (expands_to ("\\$foo", "$foo"));
90
        fail_unless (expands_to ("a\\\\b", "a\\b"));
90
        ck_assert (expands_to ("a\\\\b", "a\\b"));
91
        fail_unless (expands_to ("a\\b", "a\\b"));
91
        ck_assert (expands_to ("a\\b", "a\\b"));
92
        fail_unless (expands_to ("a\\#b", "a#b"));
92
        ck_assert (expands_to ("a\\#b", "a#b"));
93
}
93
}
94
END_TEST
94
END_TEST
95
95

Return to bug 733708