]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/testsuite.cpp
Testsuite now does something
[user/henk/code/inspircd.git] / src / testsuite.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *          the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 /* $Core: libIRCDtestsuite */
15
16 #include "inspircd.h"
17 #include "testsuite.h"
18 #include <iostream>
19
20 using namespace std;
21
22 TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance)
23 {
24         cout << "\n\n*** STARTING TESTSUITE ***\n";
25
26         std::string modname;
27
28         while (1)
29         {
30                 cout << "(1) Call all module OnRunTestSuite() methods\n";
31                 cout << "(2) Load a module\n";
32                 cout << "(3) Unload a module\n";
33                 cout << "(4) Threading tests\n";
34         
35                 switch (fgetc(stdin))
36                 {
37                         case '1':
38                                 FOREACH_MOD(I_OnRunTestSuite, OnRunTestSuite());
39                         break;
40                         case '2':
41                                 cout << "Enter module filename to load: ";
42                                 cin >> modname;
43                                 cout << (Instance->Modules->Load(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n");
44                         break;
45                         case '3':
46                                 cout << "Enter module filename to unload: ";
47                                 cin >> modname;
48                                 cout << (Instance->Modules->Unload(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n");
49                         break;
50                         case '4':
51                                 cout << (DoThreadTests() ? "\nSUCCESS!\n" : "\nFAILURE\n");
52                         break;
53                 }
54                 cout << endl;
55         }
56 }
57
58 bool TestSuite::DoThreadTests()
59 {
60         return true;
61 }
62
63 TestSuite::~TestSuite()
64 {
65         cout << "\n\n*** END OF TEST SUITE ***\n";
66 }
67