From 6303e0e25a9ad65d3646fb7961cec1bf9f6095eb Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 22 Dec 2015 00:27:37 +0000 Subject: [PATCH 1/2] Added chat message functional tests --- tests/functionaltests/functionaltests.c | 129 ++++++++++++------------ tests/functionaltests/test_message.c | 19 +++- tests/functionaltests/test_message.h | 3 +- 3 files changed, 85 insertions(+), 66 deletions(-) diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 3f79ccc8..3bda51a0 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -28,73 +28,74 @@ int main(int argc, char* argv[]) { const UnitTest all_tests[] = { - PROF_FUNC_TEST(connect_jid_requests_roster), - PROF_FUNC_TEST(connect_jid_sends_presence_after_receiving_roster), - PROF_FUNC_TEST(connect_jid_requests_bookmarks), - PROF_FUNC_TEST(connect_bad_password), - PROF_FUNC_TEST(connect_shows_presence_updates), - - PROF_FUNC_TEST(ping_multiple), - PROF_FUNC_TEST(ping_responds), - - PROF_FUNC_TEST(rooms_query), - - PROF_FUNC_TEST(presence_away), - PROF_FUNC_TEST(presence_away_with_message), - PROF_FUNC_TEST(presence_online), - PROF_FUNC_TEST(presence_online_with_message), - PROF_FUNC_TEST(presence_xa), - PROF_FUNC_TEST(presence_xa_with_message), - PROF_FUNC_TEST(presence_dnd), - PROF_FUNC_TEST(presence_dnd_with_message), - PROF_FUNC_TEST(presence_chat), - PROF_FUNC_TEST(presence_chat_with_message), - PROF_FUNC_TEST(presence_set_priority), - PROF_FUNC_TEST(presence_includes_priority), - PROF_FUNC_TEST(presence_received), - PROF_FUNC_TEST(presence_missing_resource_defaults), +// PROF_FUNC_TEST(connect_jid_requests_roster), +// PROF_FUNC_TEST(connect_jid_sends_presence_after_receiving_roster), +// PROF_FUNC_TEST(connect_jid_requests_bookmarks), +// PROF_FUNC_TEST(connect_bad_password), +// PROF_FUNC_TEST(connect_shows_presence_updates), +// +// PROF_FUNC_TEST(ping_multiple), +// PROF_FUNC_TEST(ping_responds), +// +// PROF_FUNC_TEST(rooms_query), +// +// PROF_FUNC_TEST(presence_away), +// PROF_FUNC_TEST(presence_away_with_message), +// PROF_FUNC_TEST(presence_online), +// PROF_FUNC_TEST(presence_online_with_message), +// PROF_FUNC_TEST(presence_xa), +// PROF_FUNC_TEST(presence_xa_with_message), +// PROF_FUNC_TEST(presence_dnd), +// PROF_FUNC_TEST(presence_dnd_with_message), +// PROF_FUNC_TEST(presence_chat), +// PROF_FUNC_TEST(presence_chat_with_message), +// PROF_FUNC_TEST(presence_set_priority), +// PROF_FUNC_TEST(presence_includes_priority), +// PROF_FUNC_TEST(presence_received), +// PROF_FUNC_TEST(presence_missing_resource_defaults), PROF_FUNC_TEST(message_send), - PROF_FUNC_TEST(message_receive), + PROF_FUNC_TEST(message_receive_console), + PROF_FUNC_TEST(message_receive_chatwin), - PROF_FUNC_TEST(sends_message_to_barejid_when_contact_offline), - PROF_FUNC_TEST(sends_message_to_barejid_when_contact_online), - PROF_FUNC_TEST(sends_message_to_fulljid_when_received_from_fulljid), - PROF_FUNC_TEST(sends_subsequent_messages_to_fulljid), - PROF_FUNC_TEST(resets_to_barejid_after_presence_received), - PROF_FUNC_TEST(new_session_when_message_received_from_different_fulljid), - - PROF_FUNC_TEST(send_enable_carbons), - PROF_FUNC_TEST(connect_with_carbons_enabled), - PROF_FUNC_TEST(send_disable_carbons), - PROF_FUNC_TEST(receive_carbon), - PROF_FUNC_TEST(receive_self_carbon), - - PROF_FUNC_TEST(send_receipt_request), - PROF_FUNC_TEST(send_receipt_on_request), - PROF_FUNC_TEST(sends_new_item), - PROF_FUNC_TEST(sends_new_item_nick), - PROF_FUNC_TEST(sends_remove_item), - PROF_FUNC_TEST(sends_nick_change), - - PROF_FUNC_TEST(send_software_version_request), - PROF_FUNC_TEST(display_software_version_result), - PROF_FUNC_TEST(shows_message_when_software_version_error), - PROF_FUNC_TEST(display_software_version_result_when_from_domainpart), - PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource), - PROF_FUNC_TEST(display_software_version_result_in_chat), - - PROF_FUNC_TEST(sends_room_join), - PROF_FUNC_TEST(sends_room_join_with_default_muc_service), - PROF_FUNC_TEST(sends_room_join_with_nick), - PROF_FUNC_TEST(sends_room_join_with_password), - PROF_FUNC_TEST(sends_room_join_with_nick_and_password), - PROF_FUNC_TEST(shows_role_and_affiliation_on_join), - PROF_FUNC_TEST(shows_subject_on_join), - PROF_FUNC_TEST(shows_history_message), - PROF_FUNC_TEST(shows_occupant_join), - PROF_FUNC_TEST(shows_message), - PROF_FUNC_TEST(shows_message_in_console_when_window_not_focussed), +// PROF_FUNC_TEST(sends_message_to_barejid_when_contact_offline), +// PROF_FUNC_TEST(sends_message_to_barejid_when_contact_online), +// PROF_FUNC_TEST(sends_message_to_fulljid_when_received_from_fulljid), +// PROF_FUNC_TEST(sends_subsequent_messages_to_fulljid), +// PROF_FUNC_TEST(resets_to_barejid_after_presence_received), +// PROF_FUNC_TEST(new_session_when_message_received_from_different_fulljid), +// +// PROF_FUNC_TEST(send_enable_carbons), +// PROF_FUNC_TEST(connect_with_carbons_enabled), +// PROF_FUNC_TEST(send_disable_carbons), +// PROF_FUNC_TEST(receive_carbon), +// PROF_FUNC_TEST(receive_self_carbon), +// +// PROF_FUNC_TEST(send_receipt_request), +// PROF_FUNC_TEST(send_receipt_on_request), +// PROF_FUNC_TEST(sends_new_item), +// PROF_FUNC_TEST(sends_new_item_nick), +// PROF_FUNC_TEST(sends_remove_item), +// PROF_FUNC_TEST(sends_nick_change), +// +// PROF_FUNC_TEST(send_software_version_request), +// PROF_FUNC_TEST(display_software_version_result), +// PROF_FUNC_TEST(shows_message_when_software_version_error), +// PROF_FUNC_TEST(display_software_version_result_when_from_domainpart), +// PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource), +// PROF_FUNC_TEST(display_software_version_result_in_chat), +// +// PROF_FUNC_TEST(sends_room_join), +// PROF_FUNC_TEST(sends_room_join_with_default_muc_service), +// PROF_FUNC_TEST(sends_room_join_with_nick), +// PROF_FUNC_TEST(sends_room_join_with_password), +// PROF_FUNC_TEST(sends_room_join_with_nick_and_password), +// PROF_FUNC_TEST(shows_role_and_affiliation_on_join), +// PROF_FUNC_TEST(shows_subject_on_join), +// PROF_FUNC_TEST(shows_history_message), +// PROF_FUNC_TEST(shows_occupant_join), +// PROF_FUNC_TEST(shows_message), +// PROF_FUNC_TEST(shows_message_in_console_when_window_not_focussed), }; return run_tests(all_tests); diff --git a/tests/functionaltests/test_message.c b/tests/functionaltests/test_message.c index 707b2560..e7c56fbc 100644 --- a/tests/functionaltests/test_message.c +++ b/tests/functionaltests/test_message.c @@ -28,7 +28,7 @@ message_send(void **state) } void -message_receive(void **state) +message_receive_console(void **state) { prof_connect(); @@ -40,3 +40,20 @@ message_receive(void **state) assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)")); } + +void +message_receive_chatwin(void **state) +{ + prof_connect(); + + prof_input("/msg someuser@chatserv.org"); + prof_output_exact("someuser@chatserv.org"); + + stbbr_send( + "" + "How are you?" + "" + ); + + assert_true(prof_output_regex("someuser@chatserv.org/laptop: .+How are you?")); +} diff --git a/tests/functionaltests/test_message.h b/tests/functionaltests/test_message.h index b8f03a7e..d3a1987c 100644 --- a/tests/functionaltests/test_message.h +++ b/tests/functionaltests/test_message.h @@ -1,2 +1,3 @@ void message_send(void **state); -void message_receive(void **state); +void message_receive_console(void **state); +void message_receive_chatwin(void **state); From 377a63d038be41986106c115e658ab199c570109 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 22 Dec 2015 00:45:15 +0000 Subject: [PATCH 2/2] Uncommented functional tests --- tests/functionaltests/functionaltests.c | 126 ++++++++++++------------ 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 3bda51a0..3cdb60f0 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -28,74 +28,74 @@ int main(int argc, char* argv[]) { const UnitTest all_tests[] = { -// PROF_FUNC_TEST(connect_jid_requests_roster), -// PROF_FUNC_TEST(connect_jid_sends_presence_after_receiving_roster), -// PROF_FUNC_TEST(connect_jid_requests_bookmarks), -// PROF_FUNC_TEST(connect_bad_password), -// PROF_FUNC_TEST(connect_shows_presence_updates), -// -// PROF_FUNC_TEST(ping_multiple), -// PROF_FUNC_TEST(ping_responds), -// -// PROF_FUNC_TEST(rooms_query), -// -// PROF_FUNC_TEST(presence_away), -// PROF_FUNC_TEST(presence_away_with_message), -// PROF_FUNC_TEST(presence_online), -// PROF_FUNC_TEST(presence_online_with_message), -// PROF_FUNC_TEST(presence_xa), -// PROF_FUNC_TEST(presence_xa_with_message), -// PROF_FUNC_TEST(presence_dnd), -// PROF_FUNC_TEST(presence_dnd_with_message), -// PROF_FUNC_TEST(presence_chat), -// PROF_FUNC_TEST(presence_chat_with_message), -// PROF_FUNC_TEST(presence_set_priority), -// PROF_FUNC_TEST(presence_includes_priority), -// PROF_FUNC_TEST(presence_received), -// PROF_FUNC_TEST(presence_missing_resource_defaults), + PROF_FUNC_TEST(connect_jid_requests_roster), + PROF_FUNC_TEST(connect_jid_sends_presence_after_receiving_roster), + PROF_FUNC_TEST(connect_jid_requests_bookmarks), + PROF_FUNC_TEST(connect_bad_password), + PROF_FUNC_TEST(connect_shows_presence_updates), + + PROF_FUNC_TEST(ping_multiple), + PROF_FUNC_TEST(ping_responds), + + PROF_FUNC_TEST(rooms_query), + + PROF_FUNC_TEST(presence_away), + PROF_FUNC_TEST(presence_away_with_message), + PROF_FUNC_TEST(presence_online), + PROF_FUNC_TEST(presence_online_with_message), + PROF_FUNC_TEST(presence_xa), + PROF_FUNC_TEST(presence_xa_with_message), + PROF_FUNC_TEST(presence_dnd), + PROF_FUNC_TEST(presence_dnd_with_message), + PROF_FUNC_TEST(presence_chat), + PROF_FUNC_TEST(presence_chat_with_message), + PROF_FUNC_TEST(presence_set_priority), + PROF_FUNC_TEST(presence_includes_priority), + PROF_FUNC_TEST(presence_received), + PROF_FUNC_TEST(presence_missing_resource_defaults), PROF_FUNC_TEST(message_send), PROF_FUNC_TEST(message_receive_console), PROF_FUNC_TEST(message_receive_chatwin), -// PROF_FUNC_TEST(sends_message_to_barejid_when_contact_offline), -// PROF_FUNC_TEST(sends_message_to_barejid_when_contact_online), -// PROF_FUNC_TEST(sends_message_to_fulljid_when_received_from_fulljid), -// PROF_FUNC_TEST(sends_subsequent_messages_to_fulljid), -// PROF_FUNC_TEST(resets_to_barejid_after_presence_received), -// PROF_FUNC_TEST(new_session_when_message_received_from_different_fulljid), -// -// PROF_FUNC_TEST(send_enable_carbons), -// PROF_FUNC_TEST(connect_with_carbons_enabled), -// PROF_FUNC_TEST(send_disable_carbons), -// PROF_FUNC_TEST(receive_carbon), -// PROF_FUNC_TEST(receive_self_carbon), -// -// PROF_FUNC_TEST(send_receipt_request), -// PROF_FUNC_TEST(send_receipt_on_request), -// PROF_FUNC_TEST(sends_new_item), -// PROF_FUNC_TEST(sends_new_item_nick), -// PROF_FUNC_TEST(sends_remove_item), -// PROF_FUNC_TEST(sends_nick_change), -// -// PROF_FUNC_TEST(send_software_version_request), -// PROF_FUNC_TEST(display_software_version_result), -// PROF_FUNC_TEST(shows_message_when_software_version_error), -// PROF_FUNC_TEST(display_software_version_result_when_from_domainpart), -// PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource), -// PROF_FUNC_TEST(display_software_version_result_in_chat), -// -// PROF_FUNC_TEST(sends_room_join), -// PROF_FUNC_TEST(sends_room_join_with_default_muc_service), -// PROF_FUNC_TEST(sends_room_join_with_nick), -// PROF_FUNC_TEST(sends_room_join_with_password), -// PROF_FUNC_TEST(sends_room_join_with_nick_and_password), -// PROF_FUNC_TEST(shows_role_and_affiliation_on_join), -// PROF_FUNC_TEST(shows_subject_on_join), -// PROF_FUNC_TEST(shows_history_message), -// PROF_FUNC_TEST(shows_occupant_join), -// PROF_FUNC_TEST(shows_message), -// PROF_FUNC_TEST(shows_message_in_console_when_window_not_focussed), + PROF_FUNC_TEST(sends_message_to_barejid_when_contact_offline), + PROF_FUNC_TEST(sends_message_to_barejid_when_contact_online), + PROF_FUNC_TEST(sends_message_to_fulljid_when_received_from_fulljid), + PROF_FUNC_TEST(sends_subsequent_messages_to_fulljid), + PROF_FUNC_TEST(resets_to_barejid_after_presence_received), + PROF_FUNC_TEST(new_session_when_message_received_from_different_fulljid), + + PROF_FUNC_TEST(send_enable_carbons), + PROF_FUNC_TEST(connect_with_carbons_enabled), + PROF_FUNC_TEST(send_disable_carbons), + PROF_FUNC_TEST(receive_carbon), + PROF_FUNC_TEST(receive_self_carbon), + + PROF_FUNC_TEST(send_receipt_request), + PROF_FUNC_TEST(send_receipt_on_request), + PROF_FUNC_TEST(sends_new_item), + PROF_FUNC_TEST(sends_new_item_nick), + PROF_FUNC_TEST(sends_remove_item), + PROF_FUNC_TEST(sends_nick_change), + + PROF_FUNC_TEST(send_software_version_request), + PROF_FUNC_TEST(display_software_version_result), + PROF_FUNC_TEST(shows_message_when_software_version_error), + PROF_FUNC_TEST(display_software_version_result_when_from_domainpart), + PROF_FUNC_TEST(show_message_in_chat_window_when_no_resource), + PROF_FUNC_TEST(display_software_version_result_in_chat), + + PROF_FUNC_TEST(sends_room_join), + PROF_FUNC_TEST(sends_room_join_with_default_muc_service), + PROF_FUNC_TEST(sends_room_join_with_nick), + PROF_FUNC_TEST(sends_room_join_with_password), + PROF_FUNC_TEST(sends_room_join_with_nick_and_password), + PROF_FUNC_TEST(shows_role_and_affiliation_on_join), + PROF_FUNC_TEST(shows_subject_on_join), + PROF_FUNC_TEST(shows_history_message), + PROF_FUNC_TEST(shows_occupant_join), + PROF_FUNC_TEST(shows_message), + PROF_FUNC_TEST(shows_message_in_console_when_window_not_focussed), }; return run_tests(all_tests);