diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-21 16:32:38 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2008-02-21 16:32:38 +0000 |
commit | 14b1960421814bcc6e5a744dad3d0b6d81a2771c (patch) | |
tree | 170ddeb26a0709acf5324ab21df6118c43cf37b0 /src | |
parent | 6c7bacd6c277983080f59590ca1a95c6fa37f1e4 (diff) |
Testsuite now does something
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8979 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/testsuite.cpp | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/testsuite.cpp b/src/testsuite.cpp index 9d782764e..f02b3aed3 100644 --- a/src/testsuite.cpp +++ b/src/testsuite.cpp @@ -15,15 +15,53 @@ #include "inspircd.h" #include "testsuite.h" +#include <iostream> -TestSuite::TestSuite(InspIRCd* ServerInstance) +using namespace std; + +TestSuite::TestSuite(InspIRCd* Instance) : ServerInstance(Instance) +{ + cout << "\n\n*** STARTING TESTSUITE ***\n"; + + std::string modname; + + while (1) + { + cout << "(1) Call all module OnRunTestSuite() methods\n"; + cout << "(2) Load a module\n"; + cout << "(3) Unload a module\n"; + cout << "(4) Threading tests\n"; + + switch (fgetc(stdin)) + { + case '1': + FOREACH_MOD(I_OnRunTestSuite, OnRunTestSuite()); + break; + case '2': + cout << "Enter module filename to load: "; + cin >> modname; + cout << (Instance->Modules->Load(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); + break; + case '3': + cout << "Enter module filename to unload: "; + cin >> modname; + cout << (Instance->Modules->Unload(modname.c_str()) ? "\nSUCCESS!\n" : "\nFAILURE\n"); + break; + case '4': + cout << (DoThreadTests() ? "\nSUCCESS!\n" : "\nFAILURE\n"); + break; + } + cout << endl; + } +} + +bool TestSuite::DoThreadTests() { - printf("\n\n*** STARTING TESTSUITE ***\n"); - FOREACH_MOD(I_OnRunTestSuite, OnRunTestSuite()); + return true; } TestSuite::~TestSuite() { - printf("\n\n*** END OF TEST SUITE ***\n"); + cout << "\n\n*** END OF TEST SUITE ***\n"; } |