From de747e3d46c1be9e3256716d8939148e0bc07a35 Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 4 Aug 2015 23:43:19 +0100 Subject: [PATCH] Added software version request tests --- Makefile.am | 1 + tests/functionaltests/functionaltests.c | 4 ++ tests/functionaltests/test_software.c | 59 +++++++++++++++++++++++++ tests/functionaltests/test_software.h | 3 ++ 4 files changed, 67 insertions(+) create mode 100644 tests/functionaltests/test_software.c create mode 100644 tests/functionaltests/test_software.h diff --git a/Makefile.am b/Makefile.am index 8f2ccb3f..51b97dd8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -104,6 +104,7 @@ functionaltest_sources = \ tests/functionaltests/test_carbons.c tests/functionaltests/test_carbons.h \ tests/functionaltests/test_receipts.c tests/functionaltests/test_receipts.h \ tests/functionaltests/test_roster.c tests/functionaltests/test_roster.h \ + tests/functionaltests/test_software.c tests/functionaltests/test_software.h \ tests/functionaltests/functionaltests.c main_source = src/main.c diff --git a/tests/functionaltests/functionaltests.c b/tests/functionaltests/functionaltests.c index 4b2b76ee..a253fe63 100644 --- a/tests/functionaltests/functionaltests.c +++ b/tests/functionaltests/functionaltests.c @@ -19,6 +19,7 @@ #include "test_chat_session.h" #include "test_receipts.h" #include "test_roster.h" +#include "test_software.h" #define PROF_FUNC_TEST(test) unit_test_setup_teardown(test, init_prof_test, close_prof_test) @@ -75,6 +76,9 @@ int main(int argc, char* argv[]) { 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), }; return run_tests(all_tests); diff --git a/tests/functionaltests/test_software.c b/tests/functionaltests/test_software.c new file mode 100644 index 00000000..aeb3f8f5 --- /dev/null +++ b/tests/functionaltests/test_software.c @@ -0,0 +1,59 @@ +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "proftest.h" + +void +send_software_version_request(void **state) +{ + prof_connect(); + stbbr_send( + "" + "10" + "I'm here" + "" + ); + prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""); + prof_input("/software buddy1@localhost/mobile"); + + stbbr_received( + "" + "" + "" + ); +} + +void +display_software_version_result(void **state) +{ + prof_connect(); + stbbr_send( + "" + "10" + "I'm here" + "" + ); + prof_output_exact("Buddy1 (mobile) is online, \"I'm here\""); + + stbbr_for_query("jabber:iq:version", + "" + "" + "Profanity" + "0.4.7dev.master.2cb2f83" + "" + "" + ); + prof_input("/software buddy1@localhost/mobile"); + + prof_output_exact("buddy1@localhost/mobile:"); + prof_output_exact("Name : Profanity"); + prof_output_exact("Version : 0.4.7dev.master.2cb2f83"); +} diff --git a/tests/functionaltests/test_software.h b/tests/functionaltests/test_software.h new file mode 100644 index 00000000..b031e264 --- /dev/null +++ b/tests/functionaltests/test_software.h @@ -0,0 +1,3 @@ +void send_software_version_request(void **state); +void display_software_version_result(void **state); +