From 435ff78d5ad3716f9c3081c0f86043ad8e55fc9d Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Sat, 14 Sep 2019 16:30:20 +0100 Subject: [PATCH] unit-test: Refactor unit testing building/running/info collecting for build server --- source/aclocal.m4 | 10 +- source/configure | 4 +- source/configure.ac | 3 +- source/tests/AlertIcon-32.png | Bin 472 -> 0 bytes source/tests/AlertIcon.png | Bin 309 -> 0 bytes .../CalendarDataStorageTests.cpp} | 173 ++++++----- .../tests/CalendarDataStorageTests/main.cpp | 8 + .../CommonFunctionsTests.cpp} | 35 ++- source/tests/CommonFunctionsTests/main.cpp | 8 + source/tests/Makefile.in | 184 ++++++++++++ source/tests/PriorityIcon-32.png | Bin 335 -> 0 bytes source/tests/PriorityIcon.png | Bin 257 -> 0 bytes source/tests/build-gui.sh | 16 - source/tests/build.sh | 36 --- source/tests/iCalendarEvent-Save2.ics | 0 .../iCalendarEventLoad.cpp} | 27 +- .../iCalendarEventSave.cpp} | 21 +- source/tests/iCalendarEventTests/main.cpp | 8 + .../iCalendarFreeBusyLoad.cpp} | 17 +- .../iCalendarFreeBusySave.cpp} | 15 +- source/tests/iCalendarFreeBusyTests/main.cpp | 8 + .../iCalendarJournalLoad.cpp} | 21 +- .../iCalendarJournalSave.cpp} | 17 +- source/tests/iCalendarJournalTests/main.cpp | 8 + .../iCalendarTaskLoad.cpp} | 21 +- .../iCalendarTaskSave.cpp} | 15 +- source/tests/iCalendarTaskTests/main.cpp | 8 + .../iCalendarTimeZoneLoad.cpp} | 19 +- .../iCalendarTimeZoneSave.cpp} | 15 +- source/tests/iCalendarTimeZoneTests/main.cpp | 8 + source/tests/xestiacalendar_test.cpp | 282 ------------------ source/tests/xestiacalendar_testcommon.cpp | 206 ------------- source/tests/xestiacalendar_testcommon.h | 39 --- .../xestiacalendar_testxccalendarday.cpp | 41 --- ...xestiacalendar_testxccalendarmonthview.cpp | 44 --- 35 files changed, 524 insertions(+), 793 deletions(-) delete mode 100644 source/tests/AlertIcon-32.png delete mode 100644 source/tests/AlertIcon.png rename source/tests/{xestiacalendar_calendardatastorage.h => CalendarDataStorageTests/CalendarDataStorageTests.cpp} (94%) create mode 100644 source/tests/CalendarDataStorageTests/main.cpp rename source/tests/{xestiacalendar_commonfunctions.h => CommonFunctionsTests/CommonFunctionsTests.cpp} (98%) create mode 100644 source/tests/CommonFunctionsTests/main.cpp create mode 100644 source/tests/Makefile.in delete mode 100644 source/tests/PriorityIcon-32.png delete mode 100644 source/tests/PriorityIcon.png delete mode 100755 source/tests/build-gui.sh delete mode 100755 source/tests/build.sh create mode 100644 source/tests/iCalendarEvent-Save2.ics rename source/tests/{xestiacalendar_icaleventload.h => iCalendarEventTests/iCalendarEventLoad.cpp} (98%) rename source/tests/{xestiacalendar_icaleventsave.h => iCalendarEventTests/iCalendarEventSave.cpp} (95%) create mode 100644 source/tests/iCalendarEventTests/main.cpp rename source/tests/{xestiacalendar_icalfreebusyload.h => iCalendarFreeBusyTests/iCalendarFreeBusyLoad.cpp} (97%) rename source/tests/{xestiacalendar_icalfreebusysave.h => iCalendarFreeBusyTests/iCalendarFreeBusySave.cpp} (94%) create mode 100644 source/tests/iCalendarFreeBusyTests/main.cpp rename source/tests/{xestiacalendar_icaljournalload.h => iCalendarJournalTests/iCalendarJournalLoad.cpp} (98%) rename source/tests/{xestiacalendar_icaljournalsave.h => iCalendarJournalTests/iCalendarJournalSave.cpp} (95%) create mode 100644 source/tests/iCalendarJournalTests/main.cpp rename source/tests/{xestiacalendar_icaltaskload.h => iCalendarTaskTests/iCalendarTaskLoad.cpp} (99%) rename source/tests/{xestiacalendar_icaltasksave.h => iCalendarTaskTests/iCalendarTaskSave.cpp} (97%) create mode 100644 source/tests/iCalendarTaskTests/main.cpp rename source/tests/{xestiacalendar_icaltimezoneload.h => iCalendarTimeZoneTests/iCalendarTimeZoneLoad.cpp} (98%) rename source/tests/{xestiacalendar_icaltimezonesave.h => iCalendarTimeZoneTests/iCalendarTimeZoneSave.cpp} (94%) create mode 100644 source/tests/iCalendarTimeZoneTests/main.cpp delete mode 100644 source/tests/xestiacalendar_test.cpp delete mode 100644 source/tests/xestiacalendar_testcommon.cpp delete mode 100644 source/tests/xestiacalendar_testcommon.h delete mode 100644 source/tests/xestiacalendar_testxccalendarday.cpp delete mode 100644 source/tests/xestiacalendar_testxccalendarmonthview.cpp diff --git a/source/aclocal.m4 b/source/aclocal.m4 index 1f84e49..f829a9d 100644 --- a/source/aclocal.m4 +++ b/source/aclocal.m4 @@ -1,6 +1,6 @@ -# generated automatically by aclocal 1.13.4 -*- Autoconf -*- +# generated automatically by aclocal 1.15.1 -*- Autoconf -*- -# Copyright (C) 1996-2013 Free Software Foundation, Inc. +# Copyright (C) 1996-2017 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1074,7 +1074,7 @@ AC_DEFUN([AM_PATH_WXRC], [WXRC_CHECK([$1],[$2])]) # AM_COND_IF -*- Autoconf -*- -# Copyright (C) 2008-2013 Free Software Foundation, Inc. +# Copyright (C) 2008-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1111,7 +1111,7 @@ fi[]dnl # AM_CONDITIONAL -*- Autoconf -*- -# Copyright (C) 1997-2013 Free Software Foundation, Inc. +# Copyright (C) 1997-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -1142,7 +1142,7 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 2006-2013 Free Software Foundation, Inc. +# Copyright (C) 2006-2017 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, diff --git a/source/configure b/source/configure index c1eecfb..9eef490 100755 --- a/source/configure +++ b/source/configure @@ -4850,9 +4850,8 @@ fi # [AC_SUBST([GTEST], [" @echo \"Google Test was not found on the system. Unable to build tests.\""])]) #AM_COND_IF([GTEST_FOUND], [echo "Google Test found on the system. Enabling Unit Tests."]); -ac_config_files="$ac_config_files Makefile" +ac_config_files="$ac_config_files Makefile tests/Makefile" -#AC_CONFIG_FILES([Makefile tests/Makefile]) cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure @@ -5575,6 +5574,7 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/source/configure.ac b/source/configure.ac index 6b0fbee..92a5e8f 100644 --- a/source/configure.ac +++ b/source/configure.ac @@ -187,6 +187,5 @@ AM_COND_IF([DEBUG], [echo "Debugging mode has been enabled."]) # [AC_SUBST([GTEST], [" @echo \"Google Test was not found on the system. Unable to build tests.\""])]) #AM_COND_IF([GTEST_FOUND], [echo "Google Test found on the system. Enabling Unit Tests."]); -AC_CONFIG_FILES([Makefile]) -#AC_CONFIG_FILES([Makefile tests/Makefile]) +AC_CONFIG_FILES([Makefile tests/Makefile]) AC_OUTPUT diff --git a/source/tests/AlertIcon-32.png b/source/tests/AlertIcon-32.png deleted file mode 100644 index a7fb6658e03cbb1f802b350258942ffd356af219..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsjbB*JN{mrB8z>~384^+AoS&PUnpXnkGB7w7r6!i7 zrYMwWmSiZnd-?{X=%unVFfiJ9x;TbJ9DX}}ecvGmfn)pc3b=?KoDg%=v&g;akz|0x z8C$Mx?FYUD8kjDBC+U~SArvSSBg$l)&bLYP?YlSo50`vN*%zPwY<5ng-aMH@YBSfd zZtVItUCDwWG(+5_fbxqd8_tHC ztdgs@K6DpwoWnZdsd4(pH^qdXPsDcUfMCm*YHBg zg0p%X?IPMLR{h+wuO%^3W6O?Pb&scCGyhiN$H`Fk`}(mzFK-Jnd@#~-?Ph%&eYUkg zuzXf&rAO)Fo!7mOr~dfQ#N4uV$MtRh9c@~AcWl4=N?_ZgScU`o+)GPe_@rk41O>3C LtDnm{r-UW|f4IH^ diff --git a/source/tests/AlertIcon.png b/source/tests/AlertIcon.png deleted file mode 100644 index 80106cbd6004fbe4d54f1d78beed0d739574bdcb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 309 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPN8^4et&)r`c!9XF|%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dC_dBE#WBR*she%d=L_I|3a7Iv8H$bf9bKcg+||zSQl5_ zZrmfmDzNc*ht9zRTjiGf@&G|^YP!HhE>o7v3`&3d6B+IZ2$>}NcDC?1Uh6T}wBM`Q sn>1m|uVA-H#-}dNzV!bh?;FVdQ&MBb@03%{-OaK4? diff --git a/source/tests/xestiacalendar_calendardatastorage.h b/source/tests/CalendarDataStorageTests/CalendarDataStorageTests.cpp similarity index 94% rename from source/tests/xestiacalendar_calendardatastorage.h rename to source/tests/CalendarDataStorageTests/CalendarDataStorageTests.cpp index 4e4a959..0dc0077 100644 --- a/source/tests/xestiacalendar_calendardatastorage.h +++ b/source/tests/CalendarDataStorageTests/CalendarDataStorageTests.cpp @@ -17,10 +17,23 @@ // with Xestia Calendar. If not, see #include "../libraries/CalendarDataStorage/CalendarDataStorage.h" +#include + +class CalendarDataStorageTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; Colour defaultColour; -TEST(CalendarDataStorage, Setup_Tables){ +TEST_F(CalendarDataStorageTests, Setup_Tables){ CalendarDataStorage setupTablesTest; @@ -28,7 +41,7 @@ TEST(CalendarDataStorage, Setup_Tables){ } -TEST(CalendarDataStorage, Add_One_Account){ +TEST_F(CalendarDataStorageTests, Add_One_Account){ CalendarDataStorage addOneEntryTest; @@ -36,7 +49,7 @@ TEST(CalendarDataStorage, Add_One_Account){ } -TEST(CalendarDataStorage, Add_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Two_Accounts){ CalendarDataStorage addTwoEntryTest; @@ -45,7 +58,7 @@ TEST(CalendarDataStorage, Add_Two_Accounts){ } -TEST(CalendarDataStorage, Add_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Three_Accounts){ CalendarDataStorage addThreeEntryTest; @@ -55,7 +68,7 @@ TEST(CalendarDataStorage, Add_Three_Accounts){ } -TEST(CalendarDataStorage, Add_Account_With_No_Name_And_Return_No_Name_Message){ +TEST_F(CalendarDataStorageTests, Add_Account_With_No_Name_And_Return_No_Name_Message){ CalendarDataStorage failNameTest; @@ -63,7 +76,7 @@ TEST(CalendarDataStorage, Add_Account_With_No_Name_And_Return_No_Name_Message){ } -TEST(CalendarDataStorage, Add_Account_With_Same_Name_Twice_And_Return_Failed_Message){ +TEST_F(CalendarDataStorageTests, Add_Account_With_Same_Name_Twice_And_Return_Failed_Message){ CalendarDataStorage duplicateNameTest; @@ -72,7 +85,7 @@ TEST(CalendarDataStorage, Add_Account_With_Same_Name_Twice_And_Return_Failed_Mes } -TEST(CalendarDataStorage, Get_Account_Information){ +TEST_F(CalendarDataStorageTests, Get_Account_Information){ CalendarDataStorage accountInformationTest; @@ -83,7 +96,7 @@ TEST(CalendarDataStorage, Get_Account_Information){ } -TEST(CalendarDataStorage, Get_Account_Information_That_Does_Not_Exist_Return_No_Account_Message){ +TEST_F(CalendarDataStorageTests, Get_Account_Information_That_Does_Not_Exist_Return_No_Account_Message){ CalendarDataStorage noAccountTest; @@ -91,7 +104,7 @@ TEST(CalendarDataStorage, Get_Account_Information_That_Does_Not_Exist_Return_No_ } -TEST(CalendarDataStorage, Get_Two_Accounts_Information){ +TEST_F(CalendarDataStorageTests, Get_Two_Accounts_Information){ CalendarDataStorage accountInformationTest; @@ -110,7 +123,7 @@ TEST(CalendarDataStorage, Get_Two_Accounts_Information){ } -TEST(CalendarDataStorage, Get_Three_Accounts_Information){ +TEST_F(CalendarDataStorageTests, Get_Three_Accounts_Information){ CalendarDataStorage accountInformationTest; @@ -135,7 +148,7 @@ TEST(CalendarDataStorage, Get_Three_Accounts_Information){ } -TEST(CalendarDataStorage, Get_List_Of_One_Account){ +TEST_F(CalendarDataStorageTests, Get_List_Of_One_Account){ CalendarDataStorage accountInformationTest; @@ -153,7 +166,7 @@ TEST(CalendarDataStorage, Get_List_Of_One_Account){ } -TEST(CalendarDataStorage, Get_List_Of_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Two_Accounts){ CalendarDataStorage accountInformationTest; @@ -177,7 +190,7 @@ TEST(CalendarDataStorage, Get_List_Of_Two_Accounts){ } -TEST(CalendarDataStorage, Get_List_Of_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Three_Accounts){ CalendarDataStorage accountInformationTest; @@ -207,7 +220,7 @@ TEST(CalendarDataStorage, Get_List_Of_Three_Accounts){ } -TEST(CalendarDataStorage, Update_One_Account){ +TEST_F(CalendarDataStorageTests, Update_One_Account){ CalendarDataStorage updateAccountTest; @@ -222,7 +235,7 @@ TEST(CalendarDataStorage, Update_One_Account){ } -TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_No_Name_Return_No_Name_Message){ +TEST_F(CalendarDataStorageTests, Update_One_Account_Set_Account_Name_To_No_Name_Return_No_Name_Message){ CalendarDataStorage updateAccountTest; @@ -235,7 +248,7 @@ TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_No_Name_Return_ } -TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_Existing_Account_Return_Failed_Message){ +TEST_F(CalendarDataStorageTests, Update_One_Account_Set_Account_Name_To_Existing_Account_Return_Failed_Message){ CalendarDataStorage updateAccountTest; @@ -249,7 +262,7 @@ TEST(CalendarDataStorage, Update_One_Account_Set_Account_Name_To_Existing_Accoun } -TEST(CalendarDataStorage, Update_One_Account_That_Does_Not_Exist_Return_No_Account_Message){ +TEST_F(CalendarDataStorageTests, Update_One_Account_That_Does_Not_Exist_Return_No_Account_Message){ CalendarDataStorage updateAccountTest; @@ -257,7 +270,7 @@ TEST(CalendarDataStorage, Update_One_Account_That_Does_Not_Exist_Return_No_Accou } -TEST(CalendarDataStorage, Update_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Two_Accounts){ CalendarDataStorage updateAccountTest; @@ -281,7 +294,7 @@ TEST(CalendarDataStorage, Update_Two_Accounts){ } -TEST(CalendarDataStorage, Update_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Three_Accounts){ CalendarDataStorage updateAccountTest; @@ -312,7 +325,7 @@ TEST(CalendarDataStorage, Update_Three_Accounts){ } -TEST(CalendarDataStorage, Delete_One_Account){ +TEST_F(CalendarDataStorageTests, Delete_One_Account){ CalendarDataStorage deleteAccountTest; @@ -322,7 +335,7 @@ TEST(CalendarDataStorage, Delete_One_Account){ } -TEST(CalendarDataStorage, Delete_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Delete_Two_Accounts){ CalendarDataStorage deleteAccountTest; @@ -334,7 +347,7 @@ TEST(CalendarDataStorage, Delete_Two_Accounts){ } -TEST(CalendarDataStorage, Delete_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Delete_Three_Accounts){ CalendarDataStorage deleteAccountTest; @@ -348,7 +361,7 @@ TEST(CalendarDataStorage, Delete_Three_Accounts){ } -TEST(CalendarDataStorage, Delete_Account_That_Does_Not_Exist_Return_No_Account_Message){ +TEST_F(CalendarDataStorageTests, Delete_Account_That_Does_Not_Exist_Return_No_Account_Message){ CalendarDataStorage deleteAccountTest; @@ -356,7 +369,7 @@ TEST(CalendarDataStorage, Delete_Account_That_Does_Not_Exist_Return_No_Account_M } -TEST(CalendarDataStorage, Add_One_Calendar_To_One_Account){ +TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_One_Account){ CalendarDataStorage addCalendarTest; @@ -366,7 +379,7 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_One_Account){ } -TEST(CalendarDataStorage, Add_Two_Calendars_To_One_Account){ +TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_One_Account){ CalendarDataStorage addCalendarTest; @@ -377,7 +390,7 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_One_Account){ } -TEST(CalendarDataStorage, Add_Three_Calendars_To_One_Account){ +TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_One_Account){ CalendarDataStorage addCalendarTest; @@ -389,7 +402,7 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_One_Account){ } -TEST(CalendarDataStorage, Add_Calendar_To_Account_That_Does_Not_Exist_Return_No_Account_Message){ +TEST_F(CalendarDataStorageTests, Add_Calendar_To_Account_That_Does_Not_Exist_Return_No_Account_Message){ CalendarDataStorage addCalendarTest; @@ -397,7 +410,7 @@ TEST(CalendarDataStorage, Add_Calendar_To_Account_That_Does_Not_Exist_Return_No_ } -TEST(CalendarDataStorage, Add_One_Calendar_To_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_Two_Accounts){ CalendarDataStorage addCalendarTest; @@ -410,7 +423,7 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_Two_Accounts){ } -TEST(CalendarDataStorage, Add_Two_Calendars_To_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_Two_Accounts){ CalendarDataStorage addCalendarTest; @@ -425,7 +438,7 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_Two_Accounts){ } -TEST(CalendarDataStorage, Add_Three_Calendars_To_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_Two_Accounts){ CalendarDataStorage addCalendarTest; @@ -442,7 +455,7 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_Two_Accounts){ } -TEST(CalendarDataStorage, Add_One_Calendar_To_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Add_One_Calendar_To_Three_Accounts){ CalendarDataStorage addCalendarTest; @@ -458,7 +471,7 @@ TEST(CalendarDataStorage, Add_One_Calendar_To_Three_Accounts){ } -TEST(CalendarDataStorage, Add_Two_Calendars_To_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Two_Calendars_To_Three_Accounts){ CalendarDataStorage addCalendarTest; @@ -477,7 +490,7 @@ TEST(CalendarDataStorage, Add_Two_Calendars_To_Three_Accounts){ } -TEST(CalendarDataStorage, Add_Three_Calendars_To_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Add_Three_Calendars_To_Three_Accounts){ CalendarDataStorage addCalendarTest; @@ -499,7 +512,7 @@ TEST(CalendarDataStorage, Add_Three_Calendars_To_Three_Accounts){ } -TEST(CalendarDataStorage, Get_Calendar_Information_From_One_Account){ +TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_One_Account){ CalendarDataStorage getCalendarTest; @@ -551,7 +564,7 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_One_Account){ } -TEST(CalendarDataStorage, Get_Calendar_Information_From_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_Two_Accounts){ CalendarDataStorage getCalendarTest; @@ -647,7 +660,7 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_Two_Accounts){ } -TEST(CalendarDataStorage, Get_Calendar_Information_From_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Get_Calendar_Information_From_Three_Accounts){ CalendarDataStorage getCalendarTest; @@ -789,7 +802,7 @@ TEST(CalendarDataStorage, Get_Calendar_Information_From_Three_Accounts){ } -TEST(CalendarDataStorage, Update_One_Calendar_With_One_Account){ +TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_One_Account){ CalendarDataStorage updateCalendarTest; @@ -805,7 +818,7 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_One_Account){ } -TEST(CalendarDataStorage, Update_One_Calendar_With_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_Two_Accounts){ CalendarDataStorage updateCalendarTest; @@ -829,7 +842,7 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_Two_Accounts){ } -TEST(CalendarDataStorage, Update_One_Calendar_With_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Update_One_Calendar_With_Three_Accounts){ CalendarDataStorage updateCalendarTest; @@ -859,7 +872,7 @@ TEST(CalendarDataStorage, Update_One_Calendar_With_Three_Accounts){ } -TEST(CalendarDataStorage, Update_Two_Calendars_With_One_Account){ +TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_One_Account){ CalendarDataStorage updateCalendarTest; @@ -882,7 +895,7 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_One_Account){ } -TEST(CalendarDataStorage, Update_Two_Calendars_With_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_Two_Accounts){ CalendarDataStorage updateCalendarTest; @@ -916,7 +929,7 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_Two_Accounts){ } -TEST(CalendarDataStorage, Update_Two_Calendars_With_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Two_Calendars_With_Three_Accounts){ CalendarDataStorage updateCalendarTest; @@ -962,7 +975,7 @@ TEST(CalendarDataStorage, Update_Two_Calendars_With_Three_Accounts){ } -TEST(CalendarDataStorage, Update_Three_Calendars_With_One_Account){ +TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_One_Account){ CalendarDataStorage updateCalendarTest; @@ -990,7 +1003,7 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_One_Account){ } -TEST(CalendarDataStorage, Update_Three_Calendars_With_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_Two_Accounts){ CalendarDataStorage updateCalendarTest; @@ -1034,7 +1047,7 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_Two_Accounts){ } -TEST(CalendarDataStorage, Update_Three_Calendars_With_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Update_Three_Calendars_With_Three_Accounts){ CalendarDataStorage updateCalendarTest; @@ -1094,7 +1107,7 @@ TEST(CalendarDataStorage, Update_Three_Calendars_With_Three_Accounts){ } -TEST(CalendarDataStorage, Delete_One_Calendar){ +TEST_F(CalendarDataStorageTests, Delete_One_Calendar){ CalendarDataStorage deleteCalendarTest; int calendarID = 0; @@ -1109,7 +1122,7 @@ TEST(CalendarDataStorage, Delete_One_Calendar){ } -TEST(CalendarDataStorage, Delete_Two_Calendars){ +TEST_F(CalendarDataStorageTests, Delete_Two_Calendars){ CalendarDataStorage deleteCalendarTest; int calendarID1 = 0; @@ -1129,7 +1142,7 @@ TEST(CalendarDataStorage, Delete_Two_Calendars){ } -TEST(CalendarDataStorage, Delete_Three_Calendars){ +TEST_F(CalendarDataStorageTests, Delete_Three_Calendars){ CalendarDataStorage deleteCalendarTest; int calendarID1 = 0; @@ -1154,7 +1167,7 @@ TEST(CalendarDataStorage, Delete_Three_Calendars){ } -TEST(CalendarDataStorage, Add_One_Event){ +TEST_F(CalendarDataStorageTests, Add_One_Event){ CalendarDataStorage addEventTest; @@ -1168,7 +1181,7 @@ TEST(CalendarDataStorage, Add_One_Event){ } -TEST(CalendarDataStorage, Add_Two_Events){ +TEST_F(CalendarDataStorageTests, Add_Two_Events){ CalendarDataStorage addEventTest; @@ -1187,7 +1200,7 @@ TEST(CalendarDataStorage, Add_Two_Events){ } -TEST(CalendarDataStorage, Add_Three_Events){ +TEST_F(CalendarDataStorageTests, Add_Three_Events){ CalendarDataStorage addEventTest; @@ -1211,7 +1224,7 @@ TEST(CalendarDataStorage, Add_Three_Events){ } -TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information){ +TEST_F(CalendarDataStorageTests, Add_One_Event_And_Get_Event_Basic_Information){ CalendarDataStorage addEventTest; @@ -1241,7 +1254,7 @@ TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information){ } -TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information_With_Duration){ +TEST_F(CalendarDataStorageTests, Add_One_Event_And_Get_Event_Basic_Information_With_Duration){ CalendarDataStorage addEventTest; @@ -1278,7 +1291,7 @@ TEST(CalendarDataStorage, Add_One_Event_And_Get_Event_Basic_Information_With_Dur } -TEST(CalendarDataStorage, Add_Two_Events_And_Get_Event_Basic_Information){ +TEST_F(CalendarDataStorageTests, Add_Two_Events_And_Get_Event_Basic_Information){ CalendarDataStorage addEventTest; @@ -1334,7 +1347,7 @@ TEST(CalendarDataStorage, Add_Two_Events_And_Get_Event_Basic_Information){ } -TEST(CalendarDataStorage, Add_The_Same_Three_Events_And_Get_Event_Information){ +TEST_F(CalendarDataStorageTests, Add_The_Same_Three_Events_And_Get_Event_Information){ CalendarDataStorage addEventTest; @@ -1405,7 +1418,7 @@ TEST(CalendarDataStorage, Add_The_Same_Three_Events_And_Get_Event_Information){ } -TEST(CalendarDataStorage, Add_Three_Events_And_Get_Event_Information){ +TEST_F(CalendarDataStorageTests, Add_Three_Events_And_Get_Event_Information){ CalendarDataStorage addEventTest; @@ -1481,7 +1494,7 @@ TEST(CalendarDataStorage, Add_Three_Events_And_Get_Event_Information){ } -TEST(CalendarDataStorage, Delete_One_Event){ +TEST_F(CalendarDataStorageTests, Delete_One_Event){ CalendarDataStorage deleteEventTest; @@ -1495,7 +1508,7 @@ TEST(CalendarDataStorage, Delete_One_Event){ } -TEST(CalendarDataStorage, Delete_Two_Events){ +TEST_F(CalendarDataStorageTests, Delete_Two_Events){ CalendarDataStorage deleteEventTest; @@ -1512,7 +1525,7 @@ TEST(CalendarDataStorage, Delete_Two_Events){ } -TEST(CalendarDataStorage, Delete_Three_Events){ +TEST_F(CalendarDataStorageTests, Delete_Three_Events){ CalendarDataStorage deleteEventTest; @@ -1532,7 +1545,7 @@ TEST(CalendarDataStorage, Delete_Three_Events){ } -TEST(CalendarDataStorage, Delete_One_Calendar_And_Events){ +TEST_F(CalendarDataStorageTests, Delete_One_Calendar_And_Events){ CalendarDataStorage deleteEventTest; @@ -1550,7 +1563,7 @@ TEST(CalendarDataStorage, Delete_One_Calendar_And_Events){ } -TEST(CalendarDataStorage, Delete_Two_Calendars_And_Events){ +TEST_F(CalendarDataStorageTests, Delete_Two_Calendars_And_Events){ CalendarDataStorage deleteEventTest; @@ -1584,7 +1597,7 @@ TEST(CalendarDataStorage, Delete_Two_Calendars_And_Events){ } -TEST(CalendarDataStorage, Delete_Three_Calendars_And_Events){ +TEST_F(CalendarDataStorageTests, Delete_Three_Calendars_And_Events){ CalendarDataStorage deleteEventTest; @@ -1631,7 +1644,7 @@ TEST(CalendarDataStorage, Delete_Three_Calendars_And_Events){ } -TEST(CalendarDataStorage, Delete_One_Account_And_Associated_Data){ +TEST_F(CalendarDataStorageTests, Delete_One_Account_And_Associated_Data){ CalendarDataStorage deleteAccountTest; @@ -1655,7 +1668,7 @@ TEST(CalendarDataStorage, Delete_One_Account_And_Associated_Data){ } -TEST(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){ +TEST_F(CalendarDataStorageTests, Delete_Two_Accounts_And_Associated_Data){ CalendarDataStorage deleteAccountTest; @@ -1703,7 +1716,7 @@ TEST(CalendarDataStorage, Delete_Two_Accounts_And_Associated_Data){ } -TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){ +TEST_F(CalendarDataStorageTests, Delete_Three_Accounts_And_Associated_Data){ CalendarDataStorage deleteAccountTest; @@ -1770,7 +1783,7 @@ TEST(CalendarDataStorage, Delete_Three_Accounts_And_Associated_Data){ } -TEST(CalendarDataStorage, Get_List_Of_Events_For_One_Account){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_One_Account){ CalendarDataStorage getEventsListTest; @@ -1794,7 +1807,7 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_One_Account){ } -TEST(CalendarDataStorage, Get_List_Of_Events_For_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_Two_Accounts){ CalendarDataStorage getEventsListTest; @@ -1832,7 +1845,7 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_Two_Accounts){ } -TEST(CalendarDataStorage, Get_List_Of_Events_For_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Events_For_Three_Accounts){ CalendarDataStorage getEventsListTest; @@ -1882,7 +1895,7 @@ TEST(CalendarDataStorage, Get_List_Of_Events_For_Three_Accounts){ } -TEST(CalendarDataStorage, Get_List_Of_Calendars_For_One_Account){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_One_Account){ CalendarDataStorage getEventsListTest; @@ -1908,7 +1921,7 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_One_Account){ } -TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_Two_Accounts){ CalendarDataStorage getEventsListTest; @@ -1951,7 +1964,7 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Two_Accounts){ } -TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){ +TEST_F(CalendarDataStorageTests, Get_List_Of_Calendars_For_Three_Accounts){ CalendarDataStorage getEventsListTest; @@ -2011,7 +2024,7 @@ TEST(CalendarDataStorage, Get_List_Of_Calendars_For_Three_Accounts){ } -TEST(CalendarDataStorage, Add_One_Checksum){ +TEST_F(CalendarDataStorageTests, Add_One_Checksum){ CalendarDataStorage checksumTest; @@ -2023,7 +2036,7 @@ TEST(CalendarDataStorage, Add_One_Checksum){ } -TEST(CalendarDataStorage, Add_Two_Checksus){ +TEST_F(CalendarDataStorageTests, Add_Two_Checksus){ CalendarDataStorage checksumTest; @@ -2032,7 +2045,7 @@ TEST(CalendarDataStorage, Add_Two_Checksus){ } -TEST(CalendarDataStorage, Add_Three_Checksus){ +TEST_F(CalendarDataStorageTests, Add_Three_Checksus){ CalendarDataStorage checksumTest; @@ -2042,7 +2055,7 @@ TEST(CalendarDataStorage, Add_Three_Checksus){ } -TEST(CalendarDataStorage, Add_One_Checksum_And_Get_One_Checksum){ +TEST_F(CalendarDataStorageTests, Add_One_Checksum_And_Get_One_Checksum){ CalendarDataStorage checksumTest; @@ -2057,7 +2070,7 @@ TEST(CalendarDataStorage, Add_One_Checksum_And_Get_One_Checksum){ } -TEST(CalendarDataStorage, Add_Two_Checksums_And_Get_Two_Checksums){ +TEST_F(CalendarDataStorageTests, Add_Two_Checksums_And_Get_Two_Checksums){ CalendarDataStorage checksumTest; @@ -2078,7 +2091,7 @@ TEST(CalendarDataStorage, Add_Two_Checksums_And_Get_Two_Checksums){ } -TEST(CalendarDataStorage, Add_Three_Checksums_And_Get_Three_Checksums){ +TEST_F(CalendarDataStorageTests, Add_Three_Checksums_And_Get_Three_Checksums){ CalendarDataStorage checksumTest; @@ -2105,7 +2118,7 @@ TEST(CalendarDataStorage, Add_Three_Checksums_And_Get_Three_Checksums){ } -TEST(CalendarDataStorage, Add_One_Checksum_Update_One_Checksum_And_Get_One_Checksum){ +TEST_F(CalendarDataStorageTests, Add_One_Checksum_Update_One_Checksum_And_Get_One_Checksum){ CalendarDataStorage checksumTest; @@ -2131,7 +2144,7 @@ TEST(CalendarDataStorage, Add_One_Checksum_Update_One_Checksum_And_Get_One_Check } -TEST(CalendarDataStorage, Add_Two_Checksums_Update_Two_Checksums_And_Get_Two_Checksums){ +TEST_F(CalendarDataStorageTests, Add_Two_Checksums_Update_Two_Checksums_And_Get_Two_Checksums){ CalendarDataStorage checksumTest; @@ -2169,7 +2182,7 @@ TEST(CalendarDataStorage, Add_Two_Checksums_Update_Two_Checksums_And_Get_Two_Che } -TEST(CalendarDataStorage, Add_Three_Checksums_Update_Three_Checksums_And_Get_Three_Checksums){ +TEST_F(CalendarDataStorageTests, Add_Three_Checksums_Update_Three_Checksums_And_Get_Three_Checksums){ CalendarDataStorage checksumTest; diff --git a/source/tests/CalendarDataStorageTests/main.cpp b/source/tests/CalendarDataStorageTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/CalendarDataStorageTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_commonfunctions.h b/source/tests/CommonFunctionsTests/CommonFunctionsTests.cpp similarity index 98% rename from source/tests/xestiacalendar_commonfunctions.h rename to source/tests/CommonFunctionsTests/CommonFunctionsTests.cpp index a106a58..2f24534 100644 --- a/source/tests/xestiacalendar_commonfunctions.h +++ b/source/tests/CommonFunctionsTests/CommonFunctionsTests.cpp @@ -20,15 +20,28 @@ #include "../common/text.h" #include "../common/colour.h" #include "../common/monthviewgen.h" - -TEST(CommonFunctions, FileTests){ +#include + +class CommonFunctionsTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(CommonFunctionsTests, FileTests){ ASSERT_EQ(false, FileExists("iCalendarEvent-Missing.vcf")); ASSERT_EQ(true, FileExists("iCalendarEvent-InvalidPermissions.vcf")); } -TEST(CommonFunctions, ProcessTextVectorsTests){ +TEST_F(CommonFunctionsTests, ProcessTextVectorsTests){ // Setup the objects to be used for processing. @@ -175,7 +188,7 @@ TEST(CommonFunctions, ProcessTextVectorsTests){ } -TEST(CommonFunctions, SplitValuesTests){ +TEST_F(CommonFunctionsTests, SplitValuesTests){ map textExample1TestResult; @@ -187,7 +200,7 @@ TEST(CommonFunctions, SplitValuesTests){ } -TEST(CommonFunctions, SplitNameValueTests){ +TEST_F(CommonFunctionsTests, SplitNameValueTests){ PropertyNameValue nameValueResult; @@ -201,7 +214,7 @@ TEST(CommonFunctions, SplitNameValueTests){ } -TEST(CommonFunctions, HexToInt){ +TEST_F(CommonFunctionsTests, HexToInt){ string value1 = "10"; // 16 string value2 = "50"; // 80 @@ -262,7 +275,7 @@ TEST(CommonFunctions, HexToInt){ } -TEST(CommonFunctions, SplitPathFilename){ +TEST_F(CommonFunctionsTests, SplitPathFilename){ // Setup the file split. @@ -295,7 +308,7 @@ TEST(CommonFunctions, SplitPathFilename){ } -TEST(CommonFunctions, ColourStruct){ +TEST_F(CommonFunctionsTests, ColourStruct){ Colour colour1; Colour colour2; @@ -363,7 +376,7 @@ TEST(CommonFunctions, ColourStruct){ ASSERT_EQ(32, colour8.alpha); } -TEST(CommonFunctions, OutputText){ +TEST_F(CommonFunctionsTests, OutputText){ string inputText1 = "This is an example text."; string outputText1 = "This is an example text."; @@ -438,7 +451,7 @@ TEST(CommonFunctions, OutputText){ } -TEST(CommonFunctions, PreviousMonthNumberofDays){ +TEST_F(CommonFunctionsTests, PreviousMonthNumberofDays){ // Test the year 2015 (does not have a leap year). @@ -496,7 +509,7 @@ TEST(CommonFunctions, PreviousMonthNumberofDays){ } -TEST(CommonFunctions, monthViewGenerator){ +TEST_F(CommonFunctionsTests, monthViewGenerator){ XCCalendarMonthViewGrid monthView = GenerateMonthGrid(6, 2016); diff --git a/source/tests/CommonFunctionsTests/main.cpp b/source/tests/CommonFunctionsTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/CommonFunctionsTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/Makefile.in b/source/tests/Makefile.in new file mode 100644 index 0000000..2fd4c19 --- /dev/null +++ b/source/tests/Makefile.in @@ -0,0 +1,184 @@ +CPP=g++ +STRIP=strip +CPPFLAGS=`xml2-config --cflags` `wx-config --cxxflags` -I.. -I../objects -std=c++11 -pthread -DXESTIACAL_UNITTEST -ggdb -O0 -g --coverage -fprofile-arcs -ftest-coverage +CPPLIBS=`wx-config --libs` `curl-config --libs` -lsfml-audio -lxml2 -lgtest -coverage -lsqlite3 +MAKE=make +OBJDIR=. + +ICALEVENTTESTS_OUT=xestiacalendar_icaleventtests +ICALJOURNALTESTS_OUT=xestiacalendar_icaleventtests +ICALTASKTESTS_OUT=xestiacalendar_icaltasktests +ICALFREEBUSYTESTS_OUT=xestiacalendar_icalfreebusytests +ICALTIMEZONETESTS_OUT=xestiacalendar_icaltimezonetests +COMMONFUNCTIONSTESTS_OUT=xestiacalendar_commonfunctionstests +CALENDARDATASTORAGETESTS_OUT=xestiacalendar_calendardatastoragetests + +ICALEVENTTESTS_OBJS=iCalendarEventTests/iCalendarEventLoad.cpp \ + iCalendarEventTests/iCalendarEventSave.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendarevent/CalendarEvent.cpp \ + ../objects/calendarevent/CalendarEvent-Save.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + iCalendarEventTests/main.cpp + +ICALJOURNALTESTS_OBJS=iCalendarJournalTests/iCalendarJournalLoad.cpp \ + iCalendarJournalTests/iCalendarJournalSave.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendarjournal/CalendarJournal.cpp \ + ../objects/calendarjournal/CalendarJournal-Save.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + iCalendarJournalTests/main.cpp + +ICALTASKTESTS_OBJS=iCalendarTaskTests/iCalendarTaskLoad.cpp \ + iCalendarTaskTests/iCalendarTaskSave.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendartask/CalendarTask.cpp \ + ../objects/calendartask/CalendarTask-Save.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + iCalendarTaskTests/main.cpp + +ICALFREEBUSYTESTS_OBJS=iCalendarFreeBusyTests/iCalendarFreeBusyLoad.cpp \ + iCalendarFreeBusyTests/iCalendarFreeBusySave.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendarfreebusy/CalendarFreeBusy.cpp \ + ../objects/calendarfreebusy/CalendarFreeBusy-Save.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + iCalendarFreeBusyTests/main.cpp + +ICALTIMEZONETESTS_OBJS=iCalendarTimeZoneTests/iCalendarTimeZoneLoad.cpp \ + iCalendarTimeZoneTests/iCalendarTimeZoneSave.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendartimezone/CalendarTimezone.cpp \ + ../objects/calendartimezone/CalendarTimezone-Save.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + iCalendarTimeZoneTests/main.cpp + +COMMONFUNCTIONSTESTS_OBJS=CommonFunctionsTests/CommonFunctionsTests.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + ../common/monthviewgen.cpp \ + CommonFunctionsTests/main.cpp + +CALENDARDATASTORAGETESTS_OBJS=CalendarDataStorageTests/CalendarDataStorageTests.cpp \ + ../libraries/CalendarDataStorage/CalendarDataStorage.cpp \ + ../objects/calendarobject/CalendarObject.cpp \ + ../objects/calendarobject/CalendarObject-Save.cpp \ + ../objects/calendarevent/CalendarEvent.cpp \ + ../objects/calendarevent/CalendarEvent-Save.cpp \ + ../common/random.cpp \ + ../common/file.cpp \ + ../common/text.cpp \ + CalendarDataStorageTests/main.cpp + +setupbrokenfiles: + chmod 000 iCalendarEvent-InvalidPermissions.vcf + chmod 000 iCalendarJournal-InvalidPermissions.vcf + chmod 000 iCalendarTask-InvalidPermissions.vcf + chmod 000 iCalendarFreeBusy-InvalidPermissions.vcf + chmod 000 iCalendarTimezone-InvalidPermissions.vcf + +resetbrokenfiles: + chmod 660 iCalendarEvent-InvalidPermissions.vcf + chmod 660 iCalendarJournal-InvalidPermissions.vcf + chmod 660 iCalendarTask-InvalidPermissions.vcf + chmod 660 iCalendarFreeBusy-InvalidPermissions.vcf + chmod 660 iCalendarTimezone-InvalidPermissions.vcf + +icaleventtests-objs: $(ICALEVENTTESTS_OBJS) + +icaleventtests-exec: icaleventtests-objs + $(CPP) $(CPPFLAGS) $(ICALEVENTTESTS_OBJS) -o $(ICALEVENTTESTS_OUT) $(CPPLIBS) + +icaleventtests-coverage: icaleventtests-exec + gcov iCalendarEventTests/*.cpp + ./$(ICALEVENTTESTS_OUT) --gtest_output=xml:icaleventtests.xml + lcov -c --directory . --output-file xestiacalendar_icaleventtests.info + +icaljournaltests-objs: $(ICALJOURNALTESTS_OBJS) + +icaljournaltests-exec: icaljournaltests-objs + $(CPP) $(CPPFLAGS) $(ICALJOURNALTESTS_OBJS) -o $(ICALJOURNALTESTS_OUT) $(CPPLIBS) + +icaljournaltests-coverage: icaljournaltests-exec + gcov iCalendarJournalTests/*.cpp + ./$(ICALJOURNALTESTS_OUT) --gtest_output=xml:icaljournaltests.xml + lcov -c --directory . --output-file xestiacalendar_icaljournaltests.info + +icaltasktests-objs: $(ICALTASKTESTS_OBJS) + +icaltasktests-exec: icaltasktests-objs + $(CPP) $(CPPFLAGS) $(ICALTASKTESTS_OBJS) -o $(ICALTASKTESTS_OUT) $(CPPLIBS) + +icaltasktests-coverage: icaltasktests-exec + gcov iCalendarTaskTests/*.cpp + ./$(ICALTASKTESTS_OUT) --gtest_output=xml:icaltasktests.xml + lcov -c --directory . --output-file xestiacalendar_icaltasktests.info + +icalfreebusytests-objs: $(ICALFREEBUSYTESTS_OBJS) + +icalfreebusytests-exec: icalfreebusytests-objs + $(CPP) $(CPPFLAGS) $(ICALFREEBUSYTESTS_OBJS) -o $(ICALFREEBUSYTESTS_OUT) $(CPPLIBS) + +icalfreebusytests-coverage: icalfreebusytests-exec + gcov iCalendarFreeBusyTests/*.cpp + ./$(ICALFREEBUSYTESTS_OUT) --gtest_output=xml:icalfreebusytests.xml + lcov -c --directory . --output-file xestiacalendar_icalfreebusytests.info + +icaltimezonetests-objs: $(ICALTIMEZONETESTS_OBJS) + +icaltimezonetests-exec: icaltimezonetests-objs + $(CPP) $(CPPFLAGS) $(ICALTIMEZONETESTS_OBJS) -o $(ICALTIMEZONETESTS_OUT) $(CPPLIBS) + +icaltimezonetests-coverage: icaltimezonetests-exec + gcov iCalendarTimeZoneTests/*.cpp + ./$(ICALTIMEZONETESTS_OUT) --gtest_output=xml:icaltimezonetests.xml + lcov -c --directory . --output-file xestiacalendar_icaltimezonetests.info + +commonfunctionstests-objs: $(COMMONFUNCTIONSTESTS_OBJS) + +commonfunctionstests-exec: commonfunctionstests-objs + $(CPP) $(CPPFLAGS) $(COMMONFUNCTIONSTESTS_OBJS) -o $(COMMONFUNCTIONSTESTS_OUT) $(CPPLIBS) + +commonfunctionstests-coverage: commonfunctionstests-exec + gcov CommonFunctionsTests/*.cpp + ./$(COMMONFUNCTIONSTESTS_OUT) --gtest_output=xml:commonfunctionstests.xml + lcov -c --directory . --output-file xestiacalendar_commonfunctionstests.info + +calendardatastoragetests-objs: $(CALENDARDATASTORAGETESTS_OBJS) + +calendardatastoragetests-exec: calendardatastoragetests-objs + $(CPP) $(CPPFLAGS) $(CALENDARDATASTORAGETESTS_OBJS) -o $(CALENDARDATASTORAGETESTS_OUT) $(CPPLIBS) + +calendardatastoragetests-coverage: calendardatastoragetests-exec + gcov iCalendarTimeZoneTests/*.cpp + ./$(CALENDARDATASTORAGETESTS_OUT) --gtest_output=xml:calendardatastoragetests.xml + lcov -c --directory . --output-file xestiacalendar_calendardatastoragetests.info + +clean: resetbrokenfiles + rm -rf *.gcda *.gcno *.xml *.info + rm -rf $(ICALEVENTTESTS_OUT) $(ICALJOURNALTESTS_OUT) $(ICALTASKTESTS_OUT) $(ICALFREEBUSYTESTS_OUT) $(ICALTIMEZONETESTS_OUT) $(COMMONFUNCTIONSTESTS_OUT) $(CALENDARDATASTORAGETESTS_OUT) + rm -rf Output report + +codecoverage: setupbrokenfiles icaleventtests-coverage icaljournaltests-coverage \ + icaltasktests-coverage icalfreebusytests-coverage icaltimezonetests-coverage \ + commonfunctionstests-coverage calendardatastoragetests-coverage + lcov -a xestiacalendar_icaleventtests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_icaljournaltests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_icaltasktests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_icalfreebusytests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_icaltimezonetests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_commonfunctionstests.info -o xestiacalendar_tests.info + lcov -a xestiacalendar_calendardatastoragetests.info -o xestiacalendar_tests.info + lcov -r xestiacalendar_tests.info '/usr/include/*' -o xestiacalendar_tests.info + lcov -r xestiacalendar_tests.info '*tests/*' -o xestiacalendar_tests.info + genhtml xestiacalendar_tests.info -output-directory report diff --git a/source/tests/PriorityIcon-32.png b/source/tests/PriorityIcon-32.png deleted file mode 100644 index ba5080d56c1ecb6cd4b23a3f8d6c19e2a861c024..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&pIsjbB(wXQJBuqd+0q%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dD8AX##W5t}@Z0H*d@Tw*uJtG9w0@n_&0M&y@O0{oshx%s zzg!n;o49V`_bu^j4qW!W!JXx`b!XzaOTG)3u78-~Bjj|DUx2~k+;pWV&caq{l_Ro# zUMyDIq%1b-l{5;Ax*ht;H21+aodn0bqg|l&~pvrp4RaG`UT5|)vU#-4wIR; z{b%^FDdPPC#o&+X$DRczysJC+zbQ=Y$cFhd9voNvYO-d7(Dyj!c2CWomj5nnZP&%C WZ0s7goNAs5@|UNppUXO@geCyE?|jGr diff --git a/source/tests/PriorityIcon.png b/source/tests/PriorityIcon.png deleted file mode 100644 index ceae3225eefb4d695dba64526763cc658f99a918..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 257 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt_f1s;*b z3=G`DAk4@xYmNj^kiEpy*OmPN8^4gDbe!hfDL^6F%#er@=ltB<)VvZPmw~~#C^fMp zHASI3vm`^o-P1Q9MK6^dD4y!+;uvCadh5i4yax<8nCJ2wE|BZkxoP6>6;UhKc6cc3 zeB_cj#%OkR5&Og{lU>_QLL2P9GM#Hbxmjp}+@w3f+`rF#2x2?zQ_0SKi*3odjyKn> s7#b4I?#8XxZjRrt;Gpn6_>_?a!w(K`QRl2gGmuL>UHx3vIVCg!0KElLxc~qF diff --git a/source/tests/build-gui.sh b/source/tests/build-gui.sh deleted file mode 100755 index c86a60c..0000000 --- a/source/tests/build-gui.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -g++ `wx-config --libs --cxxflags` -ggdb --std=c++11 \ -xestiacalendar_testxccalendarday.cpp \ -../widgets/XCCalendarDay.cpp \ -../widgets/XCCalendarDayEntry.cpp \ --DXESTIACAL_UNITTEST -o xestiacalendar_testgui_xccalendarday - -g++ `wx-config --libs --cxxflags` -ggdb --std=c++11 \ -xestiacalendar_testxccalendarmonthview.cpp \ -../widgets/XCCalendarMonthView.cpp \ -../widgets/XCCalendarMonthViewDayTitle.cpp \ -../widgets/XCCalendarDay.cpp \ -../widgets/XCCalendarDayEntry.cpp \ -../common/monthviewgen.cpp \ --DXESTIACAL_UNITTEST -o xestiacalendar_testgui_xccalendarmonthview diff --git a/source/tests/build.sh b/source/tests/build.sh deleted file mode 100755 index 3fe9257..0000000 --- a/source/tests/build.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# Build the library first. - -g++ -ggdb --std=c++11 -c ../libraries/CalendarDataStorage/CalendarDataStorage.cpp \ - -o ../libraries/CalendarDataStorage/CalendarDataStorage-test.o \ - -lsqlite3 -ar rcs libCalendarDataStorage-test.a ../libraries/CalendarDataStorage/CalendarDataStorage-test.o - -echo "Building main unit test app..." - -# Build the unit testing application. - -g++ `xml2-config --cflags --libs` -ggdb --std=c++11 -lcurl -lgtest -pthread \ -xestiacalendar_test.cpp xestiacalendar_testcommon.cpp xestiacalendar_populate.cpp \ -../objects/calendarevent/CalendarEvent.cpp \ -../objects/calendarevent/CalendarEvent-Save.cpp \ -../objects/calendartask/CalendarTask.cpp \ -../objects/calendartask/CalendarTask-Save.cpp \ -../objects/calendarjournal/CalendarJournal.cpp \ -../objects/calendarjournal/CalendarJournal-Save.cpp \ -../objects/calendarfreebusy/CalendarFreeBusy.cpp \ -../objects/calendarfreebusy/CalendarFreeBusy-Save.cpp \ -../objects/calendartimezone/CalendarTimezone.cpp \ -../objects/calendartimezone/CalendarTimezone-Save.cpp \ -../objects/calendarobject/CalendarObject.cpp \ -../objects/calendarobject/CalendarObject-Save.cpp \ -../common/file.cpp \ -../common/text.cpp \ -../common/uuid.cpp \ -../common/monthviewgen.cpp \ -../common/random.cpp \ -../objects/CalDAV/CalDAV.cpp \ -../objects/CalDAV/CalDAV-XMLProcessing.cpp \ --DXESTIACAL_UNITTEST -o xestiacalendar_test \ --L. -lCalendarDataStorage-test -lsqlite3 diff --git a/source/tests/iCalendarEvent-Save2.ics b/source/tests/iCalendarEvent-Save2.ics new file mode 100644 index 0000000..e69de29 diff --git a/source/tests/xestiacalendar_icaleventload.h b/source/tests/iCalendarEventTests/iCalendarEventLoad.cpp similarity index 98% rename from source/tests/xestiacalendar_icaleventload.h rename to source/tests/iCalendarEventTests/iCalendarEventLoad.cpp index fc2d986..b063b75 100644 --- a/source/tests/xestiacalendar_icaleventload.h +++ b/source/tests/iCalendarEventTests/iCalendarEventLoad.cpp @@ -1,6 +1,6 @@ -// xestiacalendar_icaleventload.h - Xestia Calendar iCalendar Event Component Unit Tests +// iCalendarEventLoad.cpp - Xestia Calendar iCalendar Event Component Unit Tests // -// (c) 2016-2017 Xestia Software Development. +// (c) 2016-2019 Xestia Software Development. // // This file is part of Xestia Calendar. // @@ -16,9 +16,22 @@ // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see -#include "../objects/calendarevent/CalendarEvent.h" +#include "../../objects/calendarevent/CalendarEvent.h" +#include -TEST(iCalendarEvent, BasicTests){ +class iCalendarEventLoadTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarEventLoadTests, BasicTests){ CalendarEventObject testEvent; @@ -28,7 +41,7 @@ TEST(iCalendarEvent, BasicTests){ } -TEST(iCalendarEvent, BaseObjectVerifyTests){ +TEST_F(iCalendarEventLoadTests, BaseObjectVerifyTests){ CalendarEventObject testEvent; testEvent.LoadFile("iCalendarEvent-Load1.vcf"); @@ -46,7 +59,7 @@ TEST(iCalendarEvent, BaseObjectVerifyTests){ } -TEST(iCalendarEvent, ObjectDataTests){ +TEST_F(iCalendarEventLoadTests, ObjectDataTests){ CalendarEventObject testEvent; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf")); @@ -1072,7 +1085,7 @@ TEST(iCalendarEvent, ObjectDataTests){ } -TEST(iCalendarEvent, AlarmTests){ +TEST_F(iCalendarEventLoadTests, AlarmTests){ CalendarEventObject testEvent; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testEvent.LoadFile("iCalendarEvent-Load2.vcf")); diff --git a/source/tests/xestiacalendar_icaleventsave.h b/source/tests/iCalendarEventTests/iCalendarEventSave.cpp similarity index 95% rename from source/tests/xestiacalendar_icaleventsave.h rename to source/tests/iCalendarEventTests/iCalendarEventSave.cpp index fd1a193..31205bb 100644 --- a/source/tests/xestiacalendar_icaleventsave.h +++ b/source/tests/iCalendarEventTests/iCalendarEventSave.cpp @@ -1,6 +1,6 @@ -// xestiacalendar_icaleventsave.h - Xestia Calendar iCalendar Event Component Save Unit Tests +// iCalendarEventSave.cpp - Xestia Calendar iCalendar Event Component Save Unit Tests // -// (c) 2016-2017 Xestia Software Development. +// (c) 2016-2019 Xestia Software Development. // // This file is part of Xestia Calendar. // @@ -16,9 +16,22 @@ // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see -#include "../objects/calendarevent/CalendarEvent.h" +#include "../../objects/calendarevent/CalendarEvent.h" +#include -TEST(iCalendarSaveEvent, SaveEventTests){ +class iCalendarEventSaveTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarEventSaveTests, SaveEventTests){ CalendarEventObject testEvent; CalendarEventObject testEvent2; diff --git a/source/tests/iCalendarEventTests/main.cpp b/source/tests/iCalendarEventTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/iCalendarEventTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_icalfreebusyload.h b/source/tests/iCalendarFreeBusyTests/iCalendarFreeBusyLoad.cpp similarity index 97% rename from source/tests/xestiacalendar_icalfreebusyload.h rename to source/tests/iCalendarFreeBusyTests/iCalendarFreeBusyLoad.cpp index 2887281..6a24f72 100644 --- a/source/tests/xestiacalendar_icalfreebusyload.h +++ b/source/tests/iCalendarFreeBusyTests/iCalendarFreeBusyLoad.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendarfreebusy/CalendarFreeBusy.h" +#include -TEST(iCalendarFreeBusy, BasicTests){ +class iCalendarFreeBusyLoadTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarFreeBusyLoadTests, BasicTests){ CalendarFreeBusyObject testFreeBusy; @@ -28,7 +41,7 @@ TEST(iCalendarFreeBusy, BasicTests){ } -TEST(iCalendarFreeBusy, ObjectDataTests){ +TEST_F(iCalendarFreeBusyLoadTests, ObjectDataTests){ CalendarFreeBusyObject testFreeBusy; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testFreeBusy.LoadFile("iCalendarFreeBusy-Load2.vcf")); diff --git a/source/tests/xestiacalendar_icalfreebusysave.h b/source/tests/iCalendarFreeBusyTests/iCalendarFreeBusySave.cpp similarity index 94% rename from source/tests/xestiacalendar_icalfreebusysave.h rename to source/tests/iCalendarFreeBusyTests/iCalendarFreeBusySave.cpp index 9f93a00..86db581 100644 --- a/source/tests/xestiacalendar_icalfreebusysave.h +++ b/source/tests/iCalendarFreeBusyTests/iCalendarFreeBusySave.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendarfreebusy/CalendarFreeBusy.h" +#include -TEST(iCalendarSaveFreeBusy, SaveFreeBusyTests){ +class iCalendarFreeBusySaveTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarFreeBusySaveTests, SaveFreeBusyTests){ CalendarFreeBusyObject testFreeBusy; CalendarFreeBusyObject testFreeBusy2; diff --git a/source/tests/iCalendarFreeBusyTests/main.cpp b/source/tests/iCalendarFreeBusyTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/iCalendarFreeBusyTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_icaljournalload.h b/source/tests/iCalendarJournalTests/iCalendarJournalLoad.cpp similarity index 98% rename from source/tests/xestiacalendar_icaljournalload.h rename to source/tests/iCalendarJournalTests/iCalendarJournalLoad.cpp index a172357..93ef4d3 100644 --- a/source/tests/xestiacalendar_icaljournalload.h +++ b/source/tests/iCalendarJournalTests/iCalendarJournalLoad.cpp @@ -16,9 +16,22 @@ // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see -#include "../objects/calendarjournal/CalendarJournal.h" - -TEST(iCalendarJournal, BasicTests){ +#include "calendarjournal/CalendarJournal.h" +#include + +class iCalendarJournalLoadTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarJournalLoadTests, BasicTests){ CalendarJournalObject testJournal; @@ -28,7 +41,7 @@ TEST(iCalendarJournal, BasicTests){ } -TEST(iCalendarJournal, ObjectDataTests){ +TEST_F(iCalendarJournalLoadTests, ObjectDataTests){ CalendarJournalObject testJournal; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testJournal.LoadFile("iCalendarJournal-Load2.vcf")); diff --git a/source/tests/xestiacalendar_icaljournalsave.h b/source/tests/iCalendarJournalTests/iCalendarJournalSave.cpp similarity index 95% rename from source/tests/xestiacalendar_icaljournalsave.h rename to source/tests/iCalendarJournalTests/iCalendarJournalSave.cpp index 851b269..186ad8d 100644 --- a/source/tests/xestiacalendar_icaljournalsave.h +++ b/source/tests/iCalendarJournalTests/iCalendarJournalSave.cpp @@ -16,9 +16,22 @@ // You should have received a copy of the GNU General Public License along // with Xestia Calendar. If not, see -#include "../objects/calendarjournal/CalendarJournal.h" +#include "calendarjournal/CalendarJournal.h" +#include -TEST(iCalendarSaveJournal, SaveEventTests){ +class iCalendarJournalSaveTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarJournalSaveTests, SaveEventTests){ CalendarJournalObject testJournal; CalendarJournalObject testJournal2; diff --git a/source/tests/iCalendarJournalTests/main.cpp b/source/tests/iCalendarJournalTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/iCalendarJournalTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_icaltaskload.h b/source/tests/iCalendarTaskTests/iCalendarTaskLoad.cpp similarity index 99% rename from source/tests/xestiacalendar_icaltaskload.h rename to source/tests/iCalendarTaskTests/iCalendarTaskLoad.cpp index 2fb4788..84e39b4 100644 --- a/source/tests/xestiacalendar_icaltaskload.h +++ b/source/tests/iCalendarTaskTests/iCalendarTaskLoad.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendartask/CalendarTask.h" - -TEST(iCalendarTask, BasicTests){ +#include + +class iCalendarTaskLoadTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarTaskLoadTests, BasicTests){ CalendarTaskObject testTask; @@ -28,7 +41,7 @@ TEST(iCalendarTask, BasicTests){ } -TEST(iCalendarTask, ObjectDataTests){ +TEST_F(iCalendarTaskLoadTests, ObjectDataTests){ CalendarTaskObject testTask; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask.LoadFile("iCalendarTask-Load2.vcf")); @@ -1058,7 +1071,7 @@ TEST(iCalendarTask, ObjectDataTests){ } -TEST(iCalendarTask, AlarmTests){ +TEST_F(iCalendarTaskLoadTests, AlarmTests){ CalendarTaskObject testTask; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTask.LoadFile("iCalendarTask-Load2.vcf")); diff --git a/source/tests/xestiacalendar_icaltasksave.h b/source/tests/iCalendarTaskTests/iCalendarTaskSave.cpp similarity index 97% rename from source/tests/xestiacalendar_icaltasksave.h rename to source/tests/iCalendarTaskTests/iCalendarTaskSave.cpp index ee3bbe4..655e6e3 100644 --- a/source/tests/xestiacalendar_icaltasksave.h +++ b/source/tests/iCalendarTaskTests/iCalendarTaskSave.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendartask/CalendarTask.h" +#include -TEST(iCalendarSaveTask, SaveTaskTests){ +class iCalendarTaskSaveTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarTaskSaveTests, SaveTaskTests){ CalendarTaskObject testTask; CalendarTaskObject testTask2; diff --git a/source/tests/iCalendarTaskTests/main.cpp b/source/tests/iCalendarTaskTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/iCalendarTaskTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_icaltimezoneload.h b/source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneLoad.cpp similarity index 98% rename from source/tests/xestiacalendar_icaltimezoneload.h rename to source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneLoad.cpp index 78dc2b9..99ef9e2 100644 --- a/source/tests/xestiacalendar_icaltimezoneload.h +++ b/source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneLoad.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendartimezone/CalendarTimezone.h" - -TEST(iCalendarTimezone, BasicTests){ +#include + +class iCalendarTimezoneLoadTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarTimezoneLoadTests, BasicTests){ CalendarTimezoneObject testTimezone; @@ -28,7 +41,7 @@ TEST(iCalendarTimezone, BasicTests){ } -TEST(iCalendarTimezone, ObjectDataTests){ +TEST_F(iCalendarTimezoneLoadTests, ObjectDataTests){ CalendarTimezoneObject testTimezone; ASSERT_EQ(CALENDAROBJECTLOAD_OK, testTimezone.LoadFile("iCalendarTimezone-Load2.vcf")); diff --git a/source/tests/xestiacalendar_icaltimezonesave.h b/source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneSave.cpp similarity index 94% rename from source/tests/xestiacalendar_icaltimezonesave.h rename to source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneSave.cpp index 2de91fd..1c2fad4 100644 --- a/source/tests/xestiacalendar_icaltimezonesave.h +++ b/source/tests/iCalendarTimeZoneTests/iCalendarTimeZoneSave.cpp @@ -17,8 +17,21 @@ // with Xestia Calendar. If not, see #include "../objects/calendartimezone/CalendarTimezone.h" +#include -TEST(iCalendarSaveTimezone, SaveTimezoneTests){ +class iCalendarTimezoneSaveTests : public ::testing::Test +{ +private: + virtual void SetUp() + { + } + + virtual void TearDown() + { + } +}; + +TEST_F(iCalendarTimezoneSaveTests, SaveTimezoneTests){ CalendarTimezoneObject testTimezone; CalendarTimezoneObject testTimezone2; diff --git a/source/tests/iCalendarTimeZoneTests/main.cpp b/source/tests/iCalendarTimeZoneTests/main.cpp new file mode 100644 index 0000000..0f36e87 --- /dev/null +++ b/source/tests/iCalendarTimeZoneTests/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(shuffle) = true; + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/source/tests/xestiacalendar_test.cpp b/source/tests/xestiacalendar_test.cpp deleted file mode 100644 index 2e4737b..0000000 --- a/source/tests/xestiacalendar_test.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// xestiacalendar_test.cpp - Xestia Calendar Unit Testing Suite. -// -// (c) 2016-2017 Xestia Software Development. -// -// This file is part of Xestia Calendar. -// -// Xestia Calendar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by the -// Free Software Foundation, version 3 of the license. -// -// Xestia Calendar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with Xestia Calendar. If not, see - -#include -#include -#include -#include -#include - -#include "xestiacalendar_commonfunctions.h" -#include "xestiacalendar_populate.h" -#include "xestiacalendar_icaleventload.h" -#include "xestiacalendar_icaleventsave.h" -#include "xestiacalendar_icaltaskload.h" -#include "xestiacalendar_icaltasksave.h" -#include "xestiacalendar_icaljournalload.h" -#include "xestiacalendar_icaljournalsave.h" -#include "xestiacalendar_icalfreebusyload.h" -#include "xestiacalendar_icalfreebusysave.h" -#include "xestiacalendar_icaltimezoneload.h" -#include "xestiacalendar_icaltimezonesave.h" -#include "xestiacalendar_calendardatastorage.h" -#include "xestiacalendar_caldav.h" - -enum MenuOpts { - TESTS_ICALLOADEVENT = 1, - TESTS_ICALSAVEEVENT, - TESTS_ICALLOADTODO, - TESTS_ICALSAVETODO, - TESTS_ICALLOADJOURNAL, - TESTS_ICALSAVEJOURNAL, - TESTS_ICALLOADFREEBUSY, - TESTS_ICALSAVEFREEBUSY, - TESTS_ICALLOADTIMEZONE, - TESTS_ICALSAVETIMEZONE, - TESTS_CALENDARDATASTORAGE, - TESTS_CALDAV, - TESTS_COMMONFUNCTIONS, - TESTS_EXTRA, - TESTS_QUIT -}; - -enum ExtraMenuOpts{ - EXTRA_POPULATECALDAV = 1, - EXTRA_RETURN -}; - -void printn(std::string text){ -// printn: Print a line and end with a newline (\n). - - std::cout << text << std::endl; - -} - -void printmenu(){ -// printmenu: Print the menu. - - std::cout << "Select an option:" << std::endl << std::endl; - std::cout << TESTS_ICALLOADEVENT << ". iCalendar Event Component Load" << std::endl; - std::cout << TESTS_ICALSAVEEVENT << ". iCalendar Event Component Save" << std::endl; - std::cout << TESTS_ICALLOADTODO << ". iCalendar Task Component Load" << std::endl; - std::cout << TESTS_ICALSAVETODO << ". iCalendar Task Component Save" << std::endl; - std::cout << TESTS_ICALLOADJOURNAL << ". iCalendar Journal Component Load" << std::endl; - std::cout << TESTS_ICALSAVEJOURNAL << ". iCalendar Journal Component Save" << std::endl; - std::cout << TESTS_ICALLOADFREEBUSY << ". iCalendar FreeBusy Component Load" << std::endl; - std::cout << TESTS_ICALSAVEFREEBUSY << ". iCalendar FreeBusy Component Save" << std::endl; - std::cout << TESTS_ICALLOADTIMEZONE << ". iCalendar Timezone Component Load" << std::endl; - std::cout << TESTS_ICALSAVETIMEZONE << ". iCalendar Timezone Component Save" << std::endl; - std::cout << TESTS_CALENDARDATASTORAGE << ". Calendar Data Storage" << std::endl; - std::cout << TESTS_CALDAV << ". CalDAV Object" << std::endl; - std::cout << TESTS_COMMONFUNCTIONS << ". Common Functions" << std::endl; - std::cout << TESTS_EXTRA << ". Extra Functions Menu" << std::endl; - std::cout << TESTS_QUIT << ". Quit" << std::endl; - std::cout << std::endl; - -} - -void printextramenu(){ - - std::cout << "Extra Functions Menu" << std::endl << std::endl; - std::cout << "Select an option:" << std::endl << std::endl; - std::cout << EXTRA_POPULATECALDAV << ". Populate CalDAV calendar" << std::endl; - std::cout << EXTRA_RETURN << ". Return to previous menu" << std::endl; - std::cout << std::endl; - -} - -void runextramenu(){ - - bool exitEnabled = false; - std::string stringOption = ""; - int testResult = 0; - - while(exitEnabled == false){ - - printextramenu(); - - // Get user input. - - std::cout << "Select Option: "; - std::cin >> stringOption; - - int intOption = -1; - - // Check if input is a number. - - try{ - intOption = stoi(stringOption); - } - - // Return to the top of the while statement if input - // really isn't a number. - - catch(std::invalid_argument e){ - printn("Error: Selected option is not a number."); - continue; - } - - // Find which option has been selected from the - // input. - - switch(intOption){ - - case EXTRA_POPULATECALDAV: - printn("Populating CalDAV calendar..."); - populatecaldav(); - break; - case EXTRA_RETURN: - return; - break; - default: - printn("Invalid menu number given."); - break; - - } - - } - -} - -int main(int argc, char* argv[]){ - - // Initialise the several libraries that have - // been included. - - ::testing::InitGoogleTest(&argc, argv); - curl_global_init(CURL_GLOBAL_ALL); - - printn("Xestia Calendar Unit Testing Application"); - printn("(c)2016 Xestia Software Development"); - printn("Note: Unit testing is currently in development"); - printn(""); - - bool exitEnabled = false; - std::string stringOption = ""; - int testResult = 0; - - while(exitEnabled == false){ - - printmenu(); - - // Get user input. - - std::cout << "Select Option: "; - std::cin >> stringOption; - - int intOption = -1; - - // Check if input is a number. - - try{ - intOption = stoi(stringOption); - } - - // Return to the top of the while statement if input - // really isn't a number. - - catch(std::invalid_argument e){ - printn("Error: Selected option is not a number."); - continue; - } - - // Find which option has been selected from the - // input. - - switch(intOption){ - - case TESTS_ICALLOADEVENT: - printn("Running iCalendar Event Component tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarEvent*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALSAVEEVENT: - printn("Running iCalendar Event Component Save tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarSaveEvent*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALLOADTODO: - printn("Running iCalendar Task Component tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarTask*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALSAVETODO: - printn("Running iCalendar Task Component Save tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarSaveTask*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALLOADJOURNAL: - printn("Running iCalendar Journal Component tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarJournal*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALSAVEJOURNAL: - printn("Running iCalendar Journal Component Save tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarSaveJournal*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALLOADFREEBUSY: - printn("Running iCalendar Free Busy Component tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarFreeBusy*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALSAVEFREEBUSY: - printn("Running iCalendar Free Busy Component Save tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarSaveFreeBusy*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALLOADTIMEZONE: - printn("Running iCalendar Timezone Component tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarTimezone*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_ICALSAVETIMEZONE: - printn("Running iCalendar Timezone Component Save tests..."); - ::testing::GTEST_FLAG(filter) = "iCalendarSaveTimezone*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_CALENDARDATASTORAGE: - printn("Running Calendar Data Storage tests..."); - ::testing::GTEST_FLAG(filter) = "CalendarDataStorage*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_CALDAV: - printn("Running CalDAV tests..."); - ::testing::GTEST_FLAG(filter) = "CalDAV*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_COMMONFUNCTIONS: - printn("Running Commmon Functions tests..."); - ::testing::GTEST_FLAG(filter) = "CommonFunctions*"; - testResult = RUN_ALL_TESTS(); - break; - case TESTS_EXTRA: - runextramenu(); - break; - case TESTS_QUIT: - return 0; - break; - default: - printn("Invalid menu number given."); - break; - - } - - } - -} diff --git a/source/tests/xestiacalendar_testcommon.cpp b/source/tests/xestiacalendar_testcommon.cpp deleted file mode 100644 index 1dd9843..0000000 --- a/source/tests/xestiacalendar_testcommon.cpp +++ /dev/null @@ -1,206 +0,0 @@ -// xestiacalendar_testcommon.cpp - Xestia Calendar Unit Test Common Functions. -// -// (c) 2016-2017 Xestia Software Development. -// -// This file is part of Xestia Calendar. -// -// Xestia Calendar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by the -// Free Software Foundation, version 3 of the license. -// -// Xestia Calendar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with Xestia Calendar. If not, see - -#include - -#include "xestiacalendar_testcommon.h" -#include "../common/file.h" - -ProcessConnectionDataFileResult ProcessConnectionDataFile(string dataFilename, - CalDAVConnectionData *connData){ - - ProcessConnectionDataFileResult processResult = PROCESSCONNECTIONDATAFILE_UNITTESTFAIL; - - // Check if the file exists and return - // PROCESSCONNECTIONDATAFILE_MISSING if not. - - if (!FileExists(dataFilename)){ - return PROCESSCONNECTIONDATAFILE_MISSING; - } - - ifstream fileStream; - string receivedStringData = ""; - - fileStream.open(dataFilename, ifstream::in); - - if (fileStream.rdstate() & ifstream::failbit){ - return PROCESSCONNECTIONDATAFILE_CANNOTOPEN; - } - - if (fileStream.rdstate() & ifstream::badbit){ - return PROCESSCONNECTIONDATAFILE_CANNOTOPEN; - } - - // Process the file. - - char *bufferRead = new char[256]; - - while (!fileStream.eof()){ - - fileStream.getline(bufferRead, 256); - receivedStringData.append(bufferRead); - receivedStringData.append("\n"); - - } - - delete[] bufferRead; - - bool newLine = false; - bool skipMode = false; - bool equalFound = false; - bool quoteMode = false; - bool serverNameFound = false; - bool serverUserFound = false; - bool serverPassFound = false; - bool serverSSLFound = false; - bool serverPortFound = false; - bool serverPrefixFound = false; - char bufferChar = 0; - int stringDataSize = receivedStringData.size(); - int seekCount = 0; - string propertyName; - string propertyValue; - - while (seekCount < stringDataSize){ - - if (receivedStringData[seekCount] == '='){ - - equalFound = true; - - } else if (receivedStringData[seekCount] == '\n'){ - - // Newline reached. Check for what type of - // data it is. - - // Chceck that the equals sign has been found, - // there is a values in the property name - // and property value before doing anything. - - if (equalFound == true && - propertyName.size() > 0 && - propertyValue.size() > 0){ - - if (propertyName == "server" && serverNameFound == false){ - - // Setup the server hostname. - - connData->hostname = propertyValue; - serverNameFound = true; - - } else if (propertyName == "port" && serverPortFound == false){ - - // Setup the server port. - - int portNum; - bool portNumValid = true; - - try{ - portNum = stoi(propertyValue); - } - - catch(const invalid_argument &oor){ - portNumValid = false; - } - - // Port Number is valid so add to the - // CalDAVConnectionData handle. - - if (portNumValid == true){ - connData->port = portNum; - serverPortFound = true; - } - - } else if (propertyName == "user" && serverUserFound == false){ - - // Setup the server user. - - connData->username = propertyValue; - serverUserFound = true; - - } else if (propertyName == "pass" && serverPassFound == false){ - - // Setup the server pass. - - connData->password = propertyValue; - serverPassFound = true; - - } else if (propertyName == "ssl" && serverSSLFound == false){ - - // Setup the server SSL status. - - if (propertyValue == "true"){ - connData->useSSL = true; - } else { - connData->useSSL = false; - } - - serverSSLFound = true; - - } else if (propertyName == "prefix" && serverPrefixFound == false){ - - // Setup the server prefix. - - connData->prefix = propertyValue; - serverPrefixFound = true; - - } - - } - - // Reset the variables. - - equalFound = false; - propertyName.clear(); - propertyValue.clear(); - - } else { - - // No special character so add it to the - // Property name or value depending on - // if the equal sign has been found. - - bufferChar = receivedStringData[seekCount]; - - if (equalFound == true){ - propertyValue += bufferChar; - } else { - propertyName += bufferChar; - } - - bufferChar = 0; - - } - - seekCount++; - - } - - // Check that the CalDAV connection data object - // contains valid data. - - bool calDAVConnDataResult = CalDAVObjectValidSettings(connData); - - if (calDAVConnDataResult == false){ - processResult = PROCESSCONNECTIONDATAFILE_INVALID; - } else { - processResult = PROCESSCONNECTIONDATAFILE_OK; - } - - return processResult; - -} \ No newline at end of file diff --git a/source/tests/xestiacalendar_testcommon.h b/source/tests/xestiacalendar_testcommon.h deleted file mode 100644 index 8c0681c..0000000 --- a/source/tests/xestiacalendar_testcommon.h +++ /dev/null @@ -1,39 +0,0 @@ -// xestiacalendar_testcommon.h - Xestia Calendar Unit Test Common Functions Header. -// -// (c) 2016-2017 Xestia Software Development. -// -// This file is part of Xestia Calendar. -// -// Xestia Calendar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by the -// Free Software Foundation, version 3 of the license. -// -// Xestia Calendar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with Xestia Calendar. If not, see - -#ifndef __TESTS_XESTIACALENDAR_TESTCOMMON_H__ -#define __TESTS_XESTIACALENDAR_TESTCOMMON_H__ - -#include "../objects/CalDAV/CalDAV.h" -#include -#include - -using namespace std; - -enum ProcessConnectionDataFileResult{ - PROCESSCONNECTIONDATAFILE_UNITTESTFAIL = -1, - PROCESSCONNECTIONDATAFILE_OK, - PROCESSCONNECTIONDATAFILE_MISSING, - PROCESSCONNECTIONDATAFILE_CANNOTOPEN, - PROCESSCONNECTIONDATAFILE_INVALID -}; - -ProcessConnectionDataFileResult ProcessConnectionDataFile(string dataFilename, - CalDAVConnectionData *connData); - -#endif \ No newline at end of file diff --git a/source/tests/xestiacalendar_testxccalendarday.cpp b/source/tests/xestiacalendar_testxccalendarday.cpp deleted file mode 100644 index 4e27439..0000000 --- a/source/tests/xestiacalendar_testxccalendarday.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// xestiacalendar_testxccalendarday.cpp - Xestia Calendar Unit Test XCCalendarDay -// -// (c) 2016-2017 Xestia Software Development. -// -// This file is part of Xestia Calendar. -// -// Xestia Calendar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by the -// Free Software Foundation, version 3 of the license. -// -// Xestia Calendar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with Xestia Calendar. If not, see - -#include -#include "../widgets/XCCalendarDay.h" - -class XCCalendarDayTest: public wxApp -{ - virtual bool OnInit(); -}; - -IMPLEMENT_APP(XCCalendarDayTest); - -using namespace std; - -bool XCCalendarDayTest::OnInit() -{ - - XCCalendarDay *frmMain = new XCCalendarDay(NULL, "XCCalendarDay Test", wxPoint(50, 50), wxSize(200, 200) ); - - frmMain->Show(); - SetTopWindow(frmMain); - - return true; - -} \ No newline at end of file diff --git a/source/tests/xestiacalendar_testxccalendarmonthview.cpp b/source/tests/xestiacalendar_testxccalendarmonthview.cpp deleted file mode 100644 index 16f0464..0000000 --- a/source/tests/xestiacalendar_testxccalendarmonthview.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// xestiacalendar_testxccalendarmonthview.cpp - Xestia Calendar Unit Test XCCalendarMonthView -// -// (c) 2016-2017 Xestia Software Development. -// -// This file is part of Xestia Calendar. -// -// Xestia Calendar is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by the -// Free Software Foundation, version 3 of the license. -// -// Xestia Calendar is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License along -// with Xestia Calendar. If not, see - -#include -#include "../widgets/XCCalendarMonthView.h" -#include "../common/monthviewgen.h" - -class XCCalendarMonthViewTest: public wxApp -{ - virtual bool OnInit(); -}; - -IMPLEMENT_APP(XCCalendarMonthViewTest); - -using namespace std; - -bool XCCalendarMonthViewTest::OnInit() -{ - - XCCalendarMonthViewGrid MonthViewGrid = GenerateMonthGrid(6, 2016); - - XCCalendarMonthView *frmMain = new XCCalendarMonthView("XCCalendarMonthView Test", wxPoint(50, 50), wxSize(200, 200), &MonthViewGrid); - - frmMain->Show(); - SetTopWindow(frmMain); - - return true; - -} \ No newline at end of file -- 2.39.5