summaryrefslogtreecommitdiff
path: root/auto_tests
diff options
context:
space:
mode:
Diffstat (limited to 'auto_tests')
-rwxr-xr-xauto_tests/friends_test.c8
-rw-r--r--auto_tests/messenger_test.c22
2 files changed, 14 insertions, 16 deletions
diff --git a/auto_tests/friends_test.c b/auto_tests/friends_test.c
index 4f777ab5..11c6bf29 100755
--- a/auto_tests/friends_test.c
+++ b/auto_tests/friends_test.c
@@ -65,7 +65,7 @@ void parent_confirm_message(int num, uint8_t *data, uint16_t length)
65 request_flags |= SECOND_FLAG; 65 request_flags |= SECOND_FLAG;
66} 66}
67 67
68void parent_confirm_status(int num, USERSTATUS_KIND status, uint8_t *data, uint16_t length) 68void parent_confirm_status(int num, uint8_t *data, uint16_t length)
69{ 69{
70 puts("OK"); 70 puts("OK");
71 request_flags |= FIRST_FLAG; 71 request_flags |= FIRST_FLAG;
@@ -110,7 +110,7 @@ void child_got_request(uint8_t *public_key, uint8_t *data, uint16_t length)
110 request_flags |= FIRST_FLAG; 110 request_flags |= FIRST_FLAG;
111} 111}
112 112
113void child_got_statuschange(int friend_num, USERSTATUS_KIND status, uint8_t *string, uint16_t length) 113void child_got_statuschange(int friend_num, uint8_t *string, uint16_t length)
114{ 114{
115 request_flags |= SECOND_FLAG; 115 request_flags |= SECOND_FLAG;
116} 116}
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
169 msync(child_id, crypto_box_PUBLICKEYBYTES, MS_SYNC); 169 msync(child_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
170 170
171 m_callback_friendrequest(child_got_request); 171 m_callback_friendrequest(child_got_request);
172 m_callback_userstatus(child_got_statuschange); 172 m_callback_statusmessage(child_got_statuschange);
173 173
174 /* wait on the friend request */ 174 /* wait on the friend request */
175 while(!(request_flags & FIRST_FLAG)) 175 while(!(request_flags & FIRST_FLAG))
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
196 } 196 }
197 197
198 msync(parent_id, crypto_box_PUBLICKEYBYTES, MS_SYNC); 198 msync(parent_id, crypto_box_PUBLICKEYBYTES, MS_SYNC);
199 m_callback_userstatus(parent_confirm_status); 199 m_callback_statusmessage(parent_confirm_status);
200 m_callback_friendmessage(parent_confirm_message); 200 m_callback_friendmessage(parent_confirm_message);
201 201
202 /* hacky way to give the child time to set up */ 202 /* hacky way to give the child time to set up */
diff --git a/auto_tests/messenger_test.c b/auto_tests/messenger_test.c
index deed498f..cc624ab6 100644
--- a/auto_tests/messenger_test.c
+++ b/auto_tests/messenger_test.c
@@ -62,16 +62,16 @@ END_TEST
62START_TEST(test_m_get_userstatus_size) 62START_TEST(test_m_get_userstatus_size)
63{ 63{
64 int rc = 0; 64 int rc = 0;
65 ck_assert_msg((m_get_userstatus_size(-1) == -1), 65 ck_assert_msg((m_get_statusmessage_size(-1) == -1),
66 "m_get_userstatus_size did NOT catch an argument of -1"); 66 "m_get_statusmessage_size did NOT catch an argument of -1");
67 ck_assert_msg((m_get_userstatus_size(REALLY_BIG_NUMBER) == -1), 67 ck_assert_msg((m_get_statusmessage_size(REALLY_BIG_NUMBER) == -1),
68 "m_get_userstatus_size did NOT catch the following argument: %d\n", 68 "m_get_statusmessage_size did NOT catch the following argument: %d\n",
69 REALLY_BIG_NUMBER); 69 REALLY_BIG_NUMBER);
70 rc = m_get_userstatus_size(friend_id_num); 70 rc = m_get_statusmessage_size(friend_id_num);
71 71
72 /* this WILL error if the original m_addfriend_norequest() failed */ 72 /* this WILL error if the original m_addfriend_norequest() failed */
73 ck_assert_msg((rc > 0 && rc <= MAX_USERSTATUS_LENGTH), 73 ck_assert_msg((rc > 0 && rc <= MAX_STATUSMESSAGE_LENGTH),
74 "m_get_userstatus_size is returning out of range values!\n" 74 "m_get_statusmessage_size is returning out of range values!\n"
75 "(this can be caused by the error of m_addfriend_norequest" 75 "(this can be caused by the error of m_addfriend_norequest"
76 " in the beginning of the suite)\n"); 76 " in the beginning of the suite)\n");
77} 77}
@@ -83,15 +83,13 @@ START_TEST(test_m_set_userstatus)
83 uint16_t good_length = strlen(status); 83 uint16_t good_length = strlen(status);
84 uint16_t bad_length = REALLY_BIG_NUMBER; 84 uint16_t bad_length = REALLY_BIG_NUMBER;
85 85
86 if(m_set_userstatus(USERSTATUS_KIND_ONLINE, 86 if(m_set_statusmessage((uint8_t *)status, bad_length) != -1)
87 (uint8_t *)status, bad_length) != -1)
88 ck_abort_msg("m_set_userstatus did NOT catch the following length: %d\n", 87 ck_abort_msg("m_set_userstatus did NOT catch the following length: %d\n",
89 REALLY_BIG_NUMBER); 88 REALLY_BIG_NUMBER);
90 89
91 if((m_set_userstatus(USERSTATUS_KIND_RETAIN, 90 if((m_set_statusmessage((uint8_t *)status, good_length)) != 0)
92 (uint8_t *)status, good_length)) != 0)
93 ck_abort_msg("m_set_userstatus did NOT return 0 on the following length: %d\n" 91 ck_abort_msg("m_set_userstatus did NOT return 0 on the following length: %d\n"
94 "MAX_USERSTATUS_LENGTH: %d\n", good_length, MAX_USERSTATUS_LENGTH); 92 "MAX_STATUSMESSAGE_LENGTH: %d\n", good_length, MAX_STATUSMESSAGE_LENGTH);
95} 93}
96END_TEST 94END_TEST
97 95