diff options
author | Jacki <jacki@thejackimonster.de> | 2024-05-11 23:29:34 +0200 |
---|---|---|
committer | Jacki <jacki@thejackimonster.de> | 2024-05-11 23:29:34 +0200 |
commit | e2193576bb83a8cbcb1e752784b1121001864d94 (patch) | |
tree | 15f78efcb47742eed48f4c1bdf7feed7dd3ddc39 /tests | |
parent | fa31fdeddfacd772c8a87fa3e378214d734aa441 (diff) | |
download | libgnunetchat-master.tar.gz libgnunetchat-master.zip |
Signed-off-by: Jacki <jacki@thejackimonster.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_gnunet_chat_attribute.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/tests/test_gnunet_chat_attribute.c b/tests/test_gnunet_chat_attribute.c index 8cd350e..3759929 100644 --- a/tests/test_gnunet_chat_attribute.c +++ b/tests/test_gnunet_chat_attribute.c | |||
@@ -170,9 +170,12 @@ on_gnunet_chat_attribute_share_attr(void *cls, | |||
170 | const struct GNUNET_CHAT_Account *account; | 170 | const struct GNUNET_CHAT_Account *account; |
171 | account = GNUNET_CHAT_get_connected(handle); | 171 | account = GNUNET_CHAT_get_connected(handle); |
172 | 172 | ||
173 | const char *account_name = GNUNET_CHAT_account_get_name(account); | ||
174 | const char *contact_name = GNUNET_CHAT_contact_get_name(contact); | ||
175 | |||
173 | ck_assert_ptr_nonnull(account); | 176 | ck_assert_ptr_nonnull(account); |
174 | ck_assert_str_eq(GNUNET_CHAT_account_get_name(account), TEST_SHARE_ID_B); | 177 | ck_assert_str_eq(account_name, TEST_SHARE_ID_B); |
175 | ck_assert_str_eq(GNUNET_CHAT_contact_get_name(contact), TEST_SHARE_ID_A); | 178 | ck_assert_str_eq(contact_name, TEST_SHARE_ID_A); |
176 | ck_assert_str_eq(name, TEST_SHARE_NAME); | 179 | ck_assert_str_eq(name, TEST_SHARE_NAME); |
177 | ck_assert_str_eq(value, TEST_SHARE_VALUE); | 180 | ck_assert_str_eq(value, TEST_SHARE_VALUE); |
178 | 181 | ||
@@ -190,6 +193,7 @@ on_gnunet_chat_attribute_share_msg(void *cls, | |||
190 | ); | 193 | ); |
191 | 194 | ||
192 | const struct GNUNET_CHAT_Account *account; | 195 | const struct GNUNET_CHAT_Account *account; |
196 | struct GNUNET_CHAT_Contact *recipient; | ||
193 | struct GNUNET_CHAT_Contact *sender; | 197 | struct GNUNET_CHAT_Contact *sender; |
194 | const char *name; | 198 | const char *name; |
195 | 199 | ||
@@ -197,6 +201,7 @@ on_gnunet_chat_attribute_share_msg(void *cls, | |||
197 | ck_assert_ptr_nonnull(message); | 201 | ck_assert_ptr_nonnull(message); |
198 | 202 | ||
199 | account = GNUNET_CHAT_message_get_account(message); | 203 | account = GNUNET_CHAT_message_get_account(message); |
204 | recipient = GNUNET_CHAT_message_get_recipient(message); | ||
200 | sender = GNUNET_CHAT_message_get_sender(message); | 205 | sender = GNUNET_CHAT_message_get_sender(message); |
201 | 206 | ||
202 | switch (GNUNET_CHAT_message_get_kind(message)) | 207 | switch (GNUNET_CHAT_message_get_kind(message)) |
@@ -285,7 +290,6 @@ on_gnunet_chat_attribute_share_msg(void *cls, | |||
285 | ), GNUNET_OK); | 290 | ), GNUNET_OK); |
286 | else if (GNUNET_YES != GNUNET_CHAT_message_is_sent(message)) | 291 | else if (GNUNET_YES != GNUNET_CHAT_message_is_sent(message)) |
287 | GNUNET_CHAT_share_attribute_with(handle, sender, TEST_SHARE_NAME); | 292 | GNUNET_CHAT_share_attribute_with(handle, sender, TEST_SHARE_NAME); |
288 | |||
289 | break; | 293 | break; |
290 | case GNUNET_CHAT_KIND_CONTACT: | 294 | case GNUNET_CHAT_KIND_CONTACT: |
291 | ck_assert_ptr_nonnull(context); | 295 | ck_assert_ptr_nonnull(context); |
@@ -295,19 +299,24 @@ on_gnunet_chat_attribute_share_msg(void *cls, | |||
295 | ck_assert_ptr_null(context); | 299 | ck_assert_ptr_null(context); |
296 | break; | 300 | break; |
297 | case GNUNET_CHAT_KIND_SHARED_ATTRIBUTES: | 301 | case GNUNET_CHAT_KIND_SHARED_ATTRIBUTES: |
298 | if (GNUNET_YES != GNUNET_CHAT_message_is_sent(message)) | 302 | if (!context) |
299 | { | 303 | { |
300 | printf("exit?\n"); | 304 | ck_assert_ptr_null(account); |
305 | ck_assert_ptr_null(sender); | ||
306 | ck_assert_ptr_null(recipient); | ||
301 | 307 | ||
302 | GNUNET_CHAT_disconnect(handle); | 308 | GNUNET_CHAT_disconnect(handle); |
303 | } | 309 | } |
304 | else | 310 | else if (GNUNET_YES == GNUNET_CHAT_message_is_sent(message)) |
305 | { | 311 | { |
306 | printf("list attributes?\n"); | 312 | ck_assert_ptr_nonnull(account); |
307 | 313 | ck_assert_ptr_nonnull(sender); | |
314 | ck_assert_ptr_nonnull(recipient); | ||
315 | ck_assert_ptr_ne(sender, recipient); | ||
316 | |||
308 | GNUNET_CHAT_get_shared_attributes( | 317 | GNUNET_CHAT_get_shared_attributes( |
309 | handle, | 318 | handle, |
310 | GNUNET_CHAT_message_get_recipient(message), | 319 | recipient, |
311 | on_gnunet_chat_attribute_share_attr, | 320 | on_gnunet_chat_attribute_share_attr, |
312 | handle | 321 | handle |
313 | ); | 322 | ); |