From bdcc0ddbf813f9b19016eb873d5abe0d9d417996 Mon Sep 17 00:00:00 2001 From: James Booth Date: Mon, 20 Jul 2015 21:28:25 +0100 Subject: Added carbon message tests --- tests/functionaltests/functionaltests.c | 6 +++ tests/functionaltests/test_carbons.c | 70 +++++++++++++++++++++++++++++++++ tests/functionaltests/test_carbons.h | 3 ++ 3 files changed, 79 insertions(+) (limited to 'tests/functionaltests') diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 60ad341c..b665ad4b 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -124,6 +124,12 @@ int main(int argc, char* argv[]) { unit_test_setup_teardown(send_disable_carbons, init_prof_test, close_prof_test), + unit_test_setup_teardown(receive_carbon, + init_prof_test, + close_prof_test), + unit_test_setup_teardown(receive_self_carbon, + init_prof_test, + close_prof_test), }; return run_tests(all_tests); diff --git a/tests/functionaltests/test_carbons.c b/tests/functionaltests/test_carbons.c index f0a8214b..96639d60 100644 --- a/tests/functionaltests/test_carbons.c +++ b/tests/functionaltests/test_carbons.c @@ -48,3 +48,73 @@ send_disable_carbons(void **state) "" )); } + +void +receive_carbon(void **state) +{ + prof_input("/carbons on"); + + prof_connect(); + assert_true(stbbr_received( + "" + )); + + stbbr_send( + "" + "10" + "On my mobile" + "" + ); + assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\"")); + prof_input("/msg Buddy1"); + prof_output_exact("unencrypted"); + + stbbr_send( + "" + "" + "" + "" + "test carbon from recipient" + "" + "" + "" + "" + ); + + assert_true(prof_output_regex("Buddy1/mobile: .+test carbon from recipient")); +} + +void +receive_self_carbon(void **state) +{ + prof_input("/carbons on"); + + prof_connect(); + assert_true(stbbr_received( + "" + )); + + stbbr_send( + "" + "10" + "On my mobile" + "" + ); + assert_true(prof_output_exact("Buddy1 (mobile) is online, \"On my mobile\"")); + prof_input("/msg Buddy1"); + prof_output_exact("unencrypted"); + + stbbr_send( + "" + "" + "" + "" + "self sent carbon" + "" + "" + "" + "" + ); + + assert_true(prof_output_regex("me: .+self sent carbon")); +} diff --git a/tests/functionaltests/test_carbons.h b/tests/functionaltests/test_carbons.h index 6f756d33..6d24c8ae 100644 --- a/tests/functionaltests/test_carbons.h +++ b/tests/functionaltests/test_carbons.h @@ -1,3 +1,6 @@ void send_enable_carbons(void **state); void connect_with_carbons_enabled(void **state); void send_disable_carbons(void **state); +void receive_carbon(void **state); +void receive_self_carbon(void **state); + -- cgit 1.4.1-2-gfad0