1 // xestiacalendar_test.cpp - Xestia Calendar Unit Testing Suite.
3 // (c) 2016 Xestia Software Development.
5 // This file is part of Xestia Calendar.
7 // Xestia Address Book is free software: you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by the
9 // Free Software Foundation, version 3 of the license.
11 // Xestia Address Book is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
19 #include <gtest/gtest.h>
24 #include "xestiacalendar_icaleventload.h"
25 #include "xestiacalendar_commonfunctions.h"
26 #include "xestiacalendar_icaltaskload.h"
27 #include "xestiacalendar_icaljournalload.h"
30 TESTS_ICALLOADEVENT = 1,
32 TESTS_ICALLOADJOURNAL,
33 TESTS_ICALLOADFREEBUSY,
34 TESTS_ICALLOADTIMEZONE,
36 TESTS_COMMONFUNCTIONS,
40 void printn(std::string text){
41 // printn: Print a line and end with a newline (\n).
43 std::cout << text << std::endl;
48 // printmenu: Print the menu.
50 std::cout << "Select an option:" << std::endl << std::endl;
51 std::cout << TESTS_ICALLOADEVENT << ". iCalendar Event Component Load" << std::endl;
52 std::cout << TESTS_ICALLOADTODO << ". iCalendar Task Component Load" << std::endl;
53 std::cout << TESTS_ICALLOADJOURNAL << ". iCalendar Journal Component Load" << std::endl;
54 std::cout << TESTS_COMMONFUNCTIONS << ". Common Functions" << std::endl;
55 std::cout << TESTS_QUIT << ". Quit" << std::endl;
56 std::cout << std::endl;
60 int main(int argc, char* argv[]){
62 ::testing::InitGoogleTest(&argc, argv);
64 printn("Xestia Calendar Unit Testing Application");
65 printn("(c)2016 Xestia Software Development");
66 printn("Note: Unit testing is currently in development");
69 bool ExitEnabled = false;
70 std::string StringOption = "";
73 while(ExitEnabled == false){
79 std::cout << "Select Option: ";
80 std::cin >> StringOption;
84 // Check if input is a number.
87 IntOption = stoi(StringOption);
90 // Return to the top of the while statement if input
91 // really isn't a number.
93 catch(std::invalid_argument e){
94 printn("Error: Selected option is not a number.");
98 // Find which option has been selected from the
103 case TESTS_ICALLOADEVENT:
104 printn("Running iCalendar Event Component tests...");
105 ::testing::GTEST_FLAG(filter) = "iCalendarEvent*";
106 TestResult = RUN_ALL_TESTS();
108 case TESTS_ICALLOADTODO:
109 printn("Running iCalendar Task Component tests...");
110 ::testing::GTEST_FLAG(filter) = "iCalendarTask*";
111 TestResult = RUN_ALL_TESTS();
113 case TESTS_ICALLOADJOURNAL:
114 printn("Running iCalendar Journal Component tests...");
115 ::testing::GTEST_FLAG(filter) = "iCalendarJournal*";
116 TestResult = RUN_ALL_TESTS();
118 case TESTS_COMMONFUNCTIONS:
119 printn("Running Commmon Functions tests...");
120 ::testing::GTEST_FLAG(filter) = "CommonFunctions*";
121 TestResult = RUN_ALL_TESTS();
123 /*case TESTS_CARDDAV:
124 printn("Running CardDAV tests...");
125 ::testing::GTEST_FLAG(filter) = "CardDAV*";
126 TestResult = RUN_ALL_TESTS();
132 printn("Invalid menu number given.");