Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
9:3ff68422f4d7
Parent:
4:1f8e079924ba
Child:
10:65ee3973594e
--- 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;
       }