From 14b1960421814bcc6e5a744dad3d0b6d81a2771c Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 21 Feb 2008 16:32:38 +0000 Subject: Testsuite now does something git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8979 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/testsuite.cpp | 46 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) (limited to 'src') 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 -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"; } -- cgit v1.2.3