Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
44:6d0ac4747f5b
Parent:
42:e423e7204e5c
Child:
45:f68fea0831d7
--- a/TestManager.cpp	Fri Sep 14 15:14:29 2012 +0000
+++ b/TestManager.cpp	Mon Sep 17 13:28:39 2012 +0000
@@ -74,8 +74,8 @@
 }
 
 TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) {
-   //_testOutcomes = (bool*)malloc(NUMBER_OF_TESTS*sizeof(bool));
-   //resetTestOutcomes();
+   _testOutcomes = (bool*)malloc(NUMBER_OF_TESTS*sizeof(bool));
+   resetTestOutcomes();
 }
 
 void TestManager::resetTestOutcomes() {
@@ -93,11 +93,11 @@
    }
 }
 
-int TestManager::executeTestProfile(TestProfile profile) {
-   //resetTestOutcomes();
+int TestManager::runTestProfile(TestProfile profile) {
+   resetTestOutcomes();
    int numPassed = 0;
    if(profile<TESTS_END) { // no test for >= 0 since TestProfile is unsigned
-      numPassed = executeTestList(gTestProfiles[profile], gTestProfileLengths[profile]);
+      numPassed = runTestList(gTestProfiles[profile], gTestProfileLengths[profile]);
    } else {
       LOG("Test profile out of bounds. Must be between 0 and %d",TESTS_END-1);
       return 0;
@@ -120,47 +120,27 @@
    }
 }
 
-/*
-VodafoneTestCase* TestManager::getTest(int index) {
-   for(int i=0; i<_tests.size(); i++) {
-      if(index==_tests[i]->_testCaseNumber)
-        return _tests[i];
-   }
-   return NULL;
-}
-*/
-
-int TestManager::executeTestList(const int *list, const int listLen) {
+int TestManager::runTestList(const int *list, const int listLen) {
    int successfullTests = 0;
    LOG("Running %d tests...",listLen);
    for(int i=0; i<listLen; i++) {
       int testIndex = list[i];
-      if(executeTest(testIndex)) {
+      if(runTest(testIndex)) {
          successfullTests++;
       }
    }
    return successfullTests;
 }
 
-bool TestManager::executeTest(int testID) {
-   VodafoneTestCase* test = constructTest(testID);//getTest(testID);
+bool TestManager::runTest(int testID) {
+   VodafoneTestCase* test = constructTest(testID);
    if(test==NULL) {
       LOG("Error. Test %d is not in test list! This will be counted as a failure.",testID);
-      //delete test;
       return false;
    }
       
    LOG("Running test %d...",testID);
-   //if(test->execute()) { //FIX Donatien
-   /*
-     Error was there:
-     If execute() is called directly, setupTest() and endTest() are NOT called!
-     In Tests 21 & 22 these routines were used to allocate/deallocate the buffer where
-      the USSD result was supposed to be stored
-     This pointer being random, random stuff happened when the USSDInterface tried to copy the response to this address
-   */
-   if(test->run()) 
-   {
+   if(test->run()) {
       LOG("...OK");
       delete test;
       return true;
@@ -170,9 +150,9 @@
    return false;
 }
 
-bool TestManager::executeTest(int id, int numTimes) {
+bool TestManager::runTest(int id, int numTimes) {
    for(int i=0; i<numTimes; i++) {
-      if(!executeTest(id))
+      if(!runTest(id))
          return false;
    }
    return true;