Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
ashleymills
Date:
Fri Aug 24 10:44:49 2012 +0000
Parent:
9:3ff68422f4d7
Parent:
8:6c30647f75d7
Child:
11:a286d8112b45
Commit message:
Merge

Changed in this revision

Tests/Test50.h Show annotated file Show diff for this revision Revisions of this file
--- a/Tests/Test20.h	Fri Aug 24 10:42:44 2012 +0000
+++ b/Tests/Test20.h	Fri Aug 24 10:44:49 2012 +0000
@@ -4,22 +4,28 @@
    public: 
       Test20(VodafoneUSBModem *m) : VodafoneTestCase(m) {
       }
+      
+      virtual void setupTest() {
+         _ussdResponse = (char*)malloc(16*sizeof(char));
+      }
    
       virtual bool runTest() {
-         char* ussdResponse = (char*)malloc(16*sizeof(char));
-         _lastRunTime = time(NULL);
+         
          LOG("Sending USSD, waiting for response.");
          
-         if(_modem->sendUSSD("*#100#",ussdResponse,16)!=0) {
+         if(_modem->sendUSSD("*#100#",_ussdResponse,16)!=0) {
             LOG("Error sending USSD");
-            _lastRunOutcome = false;
-            free(ussdResponse);
             return false;
          }
          
-         LOG("Received USSD response: \"%s\"",ussdResponse);
-         _lastRunOutcome = true;
-         free(ussdResponse);
+         LOG("Received USSD response: \"%s\"",_ussdResponse);
          return true;
       }
-};
\ No newline at end of file
+      
+      virtual void endTest() {
+         free(_ussdResponse);
+      }
+      
+   private:
+      char *_ussdResponse;
+};
--- a/VodafoneTestCase.h	Fri Aug 24 10:42:44 2012 +0000
+++ b/VodafoneTestCase.h	Fri Aug 24 10:44:49 2012 +0000
@@ -9,8 +9,11 @@
       }
       
       bool run() {
+         _lastRunTime = time(NULL);
          setupTest();
-         return endTest(runTest());  
+         _lastRunOutcome = runTest();
+         endTest();
+         return _lastRunOutcome;  
       }
       
       virtual void setupTest() {
@@ -21,9 +24,8 @@
          return true;
       }
       
-      virtual bool endTest(bool status) { 
-         _lastRunOutcome = status;
-         return status;
+      virtual void endTest() {
+         
       }
       
    protected: