#include #include "prof_cmocka.h" #include #include #include #include #include "proftest.h" void ping_server(void** state) { stbbr_for_id("prof_disco_info_onconnect_2", "" "" "" "" "" ""); stbbr_for_id("prof_ping_4", ""); stbbr_for_id("prof_ping_5", ""); prof_connect(); prof_input("/ping"); assert_true(stbbr_received( "" "" "")); assert_true(prof_output_exact("Ping response from server")); prof_input("/ping"); assert_true(stbbr_received( "" "" "")); assert_true(prof_output_exact("Ping response from server")); } void ping_server_not_supported(void** state) { stbbr_for_id("prof_disco_info_onconnect_2", "" "" "" "" ""); prof_connect(); prof_input("/ping"); assert_true(prof_output_exact("Server does not support ping requests.")); } void ping_responds_to_server_request(void** state) { prof_connect(); stbbr_send( "" "" ""); assert_true(stbbr_received( "")); } void ping_jid(void** state) { stbbr_for_id("prof_caps_4", "" "" "" "" "" "" "" ""); prof_connect(); stbbr_send( "" "10" "I'm here" "" ""); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); assert_true(stbbr_received( "" "" "")); stbbr_for_id("prof_ping_5", ""); prof_input("/ping buddy1@localhost/mobile"); assert_true(stbbr_received( "" "" "")); assert_true(prof_output_exact("Ping response from buddy1@localhost/mobile")); } void ping_jid_not_supported(void** state) { stbbr_for_id("prof_caps_4", "" "" "" "" "" "" ""); prof_connect(); stbbr_send( "" "10" "I'm here" "" ""); assert_true(prof_output_exact("Buddy1 (mobile) is online, \"I'm here\"")); assert_true(stbbr_received( "" "" "")); prof_input("/ping buddy1@localhost/mobile"); assert_true(prof_output_exact("buddy1@localhost/mobile does not support ping requests.")); }