#include #include #include #include #include #include #include #include #include #include "proftest.h" void sends_message_to_barejid_when_contact_offline(void **state) { prof_connect(); prof_input("/msg buddy1@localhost Hi there"); assert_true(stbbr_received( "" "Hi there" "" )); } void sends_message_to_barejid_when_contact_online(void **state) { prof_connect(); stbbr_send( "" "10" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online")); prof_input("/msg buddy1@localhost Hi there"); assert_true(stbbr_received( "" "Hi there" "" )); } void sends_message_to_fulljid_when_received_from_fulljid(void **state) { prof_connect(); stbbr_send( "" "10" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online")); stbbr_send( "" "First message" "" ); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); prof_input("/msg buddy1@localhost Hi there"); assert_true(stbbr_received( "" "Hi there" "" )); } void sends_subsequent_messages_to_fulljid(void **state) { prof_connect(); stbbr_send( "" "10" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online")); stbbr_send( "" "First message" "" ); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); prof_input("/msg buddy1@localhost Outgoing 1"); assert_true(stbbr_received( "" "Outgoing 1" "" )); prof_input("/msg buddy1@localhost Outgoing 2"); assert_true(stbbr_received( "" "Outgoing 2" "" )); prof_input("/msg buddy1@localhost Outgoing 3"); assert_true(stbbr_received( "" "Outgoing 3" "" )); } void resets_to_barejid_after_presence_received(void **state) { prof_connect(); stbbr_send( "" "10" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online")); stbbr_send( "" "First message" "" ); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); prof_input("/msg buddy1@localhost Outgoing 1"); assert_true(stbbr_received( "" "Outgoing 1" "" )); stbbr_send( "" "5" "dnd" "" ); assert_true(prof_output_exact("Buddy1 (laptop) is dnd")); prof_input("/msg buddy1@localhost Outgoing 2"); assert_true(stbbr_received( "" "Outgoing 2" "" )); } void new_session_when_message_received_from_different_fulljid(void **state) { prof_connect(); stbbr_send( "" "10" "" ); assert_true(prof_output_exact("Buddy1 (mobile) is online")); stbbr_send( "" "8" "away" "" ); assert_true(prof_output_exact("Buddy1 (laptop) is away")); stbbr_send( "" "From first resource" "" ); assert_true(prof_output_exact("<< incoming from Buddy1/mobile (2)")); prof_input("/msg buddy1@localhost Outgoing 1"); assert_true(stbbr_received( "" "Outgoing 1" "" )); stbbr_send( "" "From second resource" "" ); assert_true(prof_output_glob("Buddy1/laptop:*From second resource")); prof_input("/msg buddy1@localhost Outgoing 2"); assert_true(stbbr_received( "" "Outgoing 2" "" )); }