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:42:44 2012 +0000
Parent:
7:ec0db221f897
Child:
10:65ee3973594e
Commit message:
Merge

Changed in this revision

TestManager.cpp Show annotated file Show diff for this revision Revisions of this file
Tests/Test12.h Show annotated file Show diff for this revision Revisions of this file
Tests/Test50.h Show annotated file Show diff for this revision Revisions of this file
--- a/TestManager.cpp	Thu Aug 23 16:02:34 2012 +0000
+++ b/TestManager.cpp	Fri Aug 24 10:42:44 2012 +0000
@@ -1,8 +1,9 @@
 #include "TestManager.h"
 #include "Tests.h"
 TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) { 
+   //_tests.push_back((VodafoneTestCase*)new Test12(_modem));
    _tests.push_back((VodafoneTestCase*)new Test20(_modem));
-   _tests.push_back((VodafoneTestCase*)new Test12(_modem));
+   _tests.push_back((VodafoneTestCase*)new Test50(_modem));
 }
 
 int TestManager::runAll() {
--- a/Tests/Test12.h	Thu Aug 23 16:02:34 2012 +0000
+++ b/Tests/Test12.h	Fri Aug 24 10:42:44 2012 +0000
@@ -14,7 +14,6 @@
       }
    
       virtual bool runTest() {
-         _lastRunTime = time(NULL);
          LOG("Receiving SMS from test phone, waiting for response.");
          char smsResponse[64];
       
@@ -36,11 +35,9 @@
                 if(ret)
                     {
                         LOG("Error receiving sms. The method getSMS  returned %d", ret);
-                        _lastRunOutcome = true;
                         return false;
                     }
                 LOG("The message is from number: %s and the message is: \"%s\"", num, msg);
-                _lastRunOutcome = true;
                 return true;
                 }
                 Thread::wait(500);
--- a/Tests/Test50.h	Thu Aug 23 16:02:34 2012 +0000
+++ b/Tests/Test50.h	Fri Aug 24 10:42:44 2012 +0000
@@ -17,24 +17,22 @@
       }
       
       virtual bool runTest() {
+         int numIterations = 10;
          size_t smCount;
          LOG("Getting MSISDN");
          _modem->sendUSSD("*#100#",_ownNumber,_numberLen);
          LOG("Got  MSISDN %s",_ownNumber);
-         for(int i=0; i<5; i++) {
-            LOG("Creating random string");
+         for(int i=0; i<numIterations; i++) {
             createRandomString(_smsOut,_smsLen);
             LOG("Created: %s",_smsOut);
-            if(_modem->sendSM(_ownNumber,_smsOut)==0) {
-               LOG("Sent short message");
+            if(_modem->sendSM(_ownNumber,_smsOut)!=0) {
+               LOG("Error sending short message");
             }
             bool gotMessage = false;
             while(!gotMessage) {
                if(_modem->getSMCount(&smCount)!=0) {
                   LOG("Faiure getting SM count");
                   return false;
-               } else {
-                  //LOG("Got SMCount (%d)",smCount);
                }
                
                if(smCount>0) {
@@ -43,6 +41,10 @@
                      return false;
                   }
                   LOG("Got SMS: %s",_smsIn);
+                  if(strcmp(_smsIn,_smsOut)!=0) {
+                     LOG("FAIL: strings did not match");
+                     return false;
+                  }
                   gotMessage = true;
                }
                Thread::wait(50);
@@ -55,7 +57,7 @@
    private:
       void createRandomString(char *target, int len) {
          for(int i=0; i<len; i++) {
-            target[i] = 65+rand()%32;
+            target[i] = 65+rand()%16;
          }
          target[len-1] = 0x00;
       }