Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Files at this revision

API Documentation at this revision

Comitter:
ashleymills
Date:
Tue Sep 04 15:31:55 2012 +0000
Parent:
19:26fbed33d4e7
Child:
21:3875fe74d358
Commit message:
Added long USSD test.

Changed in this revision

TestManager.cpp Show annotated file Show diff for this revision Revisions of this file
Tests/Test23.cpp Show annotated file Show diff for this revision Revisions of this file
Tests/Test23.h Show annotated file Show diff for this revision Revisions of this file
Tests/Tests.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/TestManager.cpp	Mon Sep 03 16:02:58 2012 +0000
+++ b/TestManager.cpp	Tue Sep 04 15:31:55 2012 +0000
@@ -5,17 +5,18 @@
    for(int i=0; i<12; i++) {
       _tests.push_back(NULL);
    }
-   _tests.push_back((VodafoneTestCase*)new Test12(_modem, 12));
-   _tests.push_back((VodafoneTestCase*)new Test13(_modem, 13));
+   _tests.push_back((VodafoneTestCase*)new Test12(_modem,12));
+   _tests.push_back((VodafoneTestCase*)new Test13(_modem,13));
    for(int i=14; i<21; i++) {
       _tests.push_back(NULL);
    }
-   _tests.push_back((VodafoneTestCase*)new Test21(_modem, 21));
-   _tests.push_back((VodafoneTestCase*)new Test22(_modem, 22));
-   for(int i=23; i<50; i++) {
+   _tests.push_back((VodafoneTestCase*)new Test21(_modem,21));
+   _tests.push_back((VodafoneTestCase*)new Test22(_modem,22));
+   _tests.push_back((VodafoneTestCase*)new Test23(_modem,23));
+   for(int i=24; i<50; i++) {
       _tests.push_back(NULL);
    }
-   _tests.push_back((VodafoneTestCase*)new Test50(_modem, 50));
+   _tests.push_back((VodafoneTestCase*)new Test50(_modem,50));
 }
 
 int TestManager::executeTestList(const int *list, const int listLen) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test23.cpp	Tue Sep 04 15:31:55 2012 +0000
@@ -0,0 +1,31 @@
+#pragma once
+#include "Test23.h"
+
+const char *Test23Description = "Test %d sending USSD over 150 chars \"0(0)00 ... 000(160)\"\0";
+const char *Test23USSDMessage = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\0";
+
+Test23::Test23(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { }
+      
+// virtual
+void Test23::setupTest() {
+   _ussdResponse = (char*)malloc(16*sizeof(char));
+}
+   
+// virtual
+bool Test23::runTest() {
+
+   LOG(Test23Description, _testCaseNumber);
+         
+   if(_modem->sendUSSD(Test23USSDMessage,_ussdResponse,16)!=0) {
+      LOG("Error sending USSD");
+      return false;
+   }
+         
+   LOG("Expecting \"Unknown Command\". Received USSD response: \"%s\"",_ussdResponse);
+   return (strcmp(_ussdResponse,"Unknown command")==0);
+}
+      
+// virtual
+void Test23::endTest() {
+   free(_ussdResponse);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test23.h	Tue Sep 04 15:31:55 2012 +0000
@@ -0,0 +1,12 @@
+#pragma once
+#include "VodafoneTestCase.h"
+class Test23 : public VodafoneTestCase {
+   public: 
+      Test23(VodafoneUSBModem *m, int tcNumber);
+      virtual void setupTest();
+      virtual bool runTest();
+      virtual void endTest();
+      
+   private:
+      char *_ussdResponse;
+};
\ No newline at end of file
--- a/Tests/Tests.h	Mon Sep 03 16:02:58 2012 +0000
+++ b/Tests/Tests.h	Tue Sep 04 15:31:55 2012 +0000
@@ -3,9 +3,10 @@
 #include "Test13.h"
 #include "Test21.h"
 #include "Test22.h"
+#include "Test23.h"
 #include "Test50.h"
 
-const int gAutomatedTests[] = {21,22,50};
-const int gNumAutomatedTests = 3;
+const int gAutomatedTests[] = {21,22,23,50};
+const int gNumAutomatedTests = 4;
 const int gInteractiveTests[] = {12,13};
 const int gNumInteractiveTests = 2;
\ No newline at end of file
--- a/main.cpp	Mon Sep 03 16:02:58 2012 +0000
+++ b/main.cpp	Tue Sep 04 15:31:55 2012 +0000
@@ -10,8 +10,8 @@
 #include "rtos.h"
 #include "VodafoneUSBModem.h"
 #include "VodafoneTestCase.h"
+#include "TestManager.h"
 #include "Tests.h"
-#include "TestManager.h"
 
 DigitalOut led1(LED1);
 DigitalOut led2(LED2);