Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Revision 25:55b865c41f21, committed 2012-09-06
- Comitter:
- ashleymills
- Date:
- Thu Sep 06 13:35:25 2012 +0000
- Parent:
- 24:8f0f9551122a
- Child:
- 26:9eefab9e28df
- Commit message:
- Added descriptions for each test.
Changed in this revision
--- a/Tests/Test10.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test10.h Thu Sep 06 13:35:25 2012 +0000 @@ -3,6 +3,7 @@ #include "HTTPClient.h" static const char* gTest10Description = "Connects to internet and downloads 100 byte file.\0"; + class Test10 : public VodafoneTestCase { public: Test10(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) {
--- a/Tests/Test12.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test12.h Thu Sep 06 13:35:25 2012 +0000 @@ -10,6 +10,7 @@ // it waits forever for an SMS. // TODO: this should wait for a set time before failing. +static const char *gTest12Description = "Waiting for an SMS message...\0"; class Test12 : public VodafoneTestCase { public: @@ -22,7 +23,8 @@ } virtual bool runTest() { - LOG("Test %d waiting for an SMS message...", _testCaseNumber); + LOG("Test: %d",_testCaseNumber); + LOG(gTest12Description); LOG("Receiving SMS from test phone, waiting for response."); while(true)
--- a/Tests/Test21.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test21.h Thu Sep 06 13:35:25 2012 +0000 @@ -1,5 +1,8 @@ #pragma once #include "VodafoneTestCase.h" + +static const char* gTest21Description = "Ttrying out USSD communication sending *#100#\0"; + class Test21 : public VodafoneTestCase { public: Test21(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -10,8 +13,7 @@ } virtual bool runTest() { - - LOG("Test %d trying out USSD communication sending *#100#", _testCaseNumber); + LOG(gTest21Description); if(_modem->sendUSSD("*#100#",_ussdResponse,16)!=0) { LOG("Error sending USSD");
--- a/Tests/Test22.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test22.h Thu Sep 06 13:35:25 2012 +0000 @@ -1,5 +1,7 @@ #pragma once #include "VodafoneTestCase.h" +static const char* gTest22Description = "Sending BAD USSD string \".2890\"\0"; + class Test22 : public VodafoneTestCase { public: Test22(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -10,8 +12,7 @@ } virtual bool runTest() { - - LOG("Test %d trying out BAD USSD string \".2890\"", _testCaseNumber); + LOG(gTest22Description); if(_modem->sendUSSD(".2890",_ussdResponse,16)!=0) { LOG("Error sending USSD");
--- a/Tests/Test23.cpp Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test23.cpp Thu Sep 06 13:35:25 2012 +0000 @@ -1,31 +1,30 @@ -#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); +#pragma once +#include "Test23.h" + +const char *gTest23Description = "Sending USSD over 150 chars \"0(0)00 ... 000(160)\"\0"; +const char gTest23USSDMessage[161] = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\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(gTest23Description); + + if(_modem->sendUSSD(gTest23USSDMessage,_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
--- a/Tests/Test25.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test25.h Thu Sep 06 13:35:25 2012 +0000 @@ -1,5 +1,7 @@ #pragma once #include "VodafoneTestCase.h" +static const char* gTest25Description = "Retrieve signal strength and print it.\0"; + class Test25 : public VodafoneTestCase { public: Test25(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -11,7 +13,7 @@ virtual bool runTest() { - LOG("Test %d, getting signal strength.", _testCaseNumber); + LOG(gTest25Description); int rssi = -1000; LinkMonitor::REGISTRATION_STATE regState = LinkMonitor::REGISTRATION_STATE_UNKNOWN; LinkMonitor::BEARER bearer = LinkMonitor::BEARER_UNKNOWN;
--- a/Tests/Test26.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test26.h Thu Sep 06 13:35:25 2012 +0000 @@ -1,5 +1,8 @@ #pragma once #include "VodafoneTestCase.h" + +static const char* gTest26Description = "x30 -> Retrieve signal strength and print it.\0"; + class Test26 : public VodafoneTestCase { public: Test26(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -10,7 +13,7 @@ } virtual bool runTest() { - LOG("Test %d, getting signal strength 30 times.", _testCaseNumber); + LOG(gTest26Description); for(int count=0; count<30; count++) { LOG("Iteration %d of 30",count); int rssi = -1000;
--- a/Tests/Test50.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Test50.h Thu Sep 06 13:35:25 2012 +0000 @@ -1,5 +1,8 @@ #pragma once #include "VodafoneTestCase.h" + +static const char* gTest50Description = "x10 -> Retreive MSISDN and send SMS to self\0"; + class Test50 : public VodafoneTestCase { public: Test50(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { @@ -16,9 +19,10 @@ } virtual bool runTest() { + LOG(gTest50Description); int numIterations = 10; size_t smCount; - LOG("Test %d getting MSISDN and sending SMS to myself...", _testCaseNumber); + LOG("...", _testCaseNumber); LOG("Getting MSISDN"); _modem->sendUSSD("*#100#",_ownNumber,_numberLen); LOG("Got MSISDN %s",_ownNumber);
--- a/Tests/Tests.h Thu Sep 06 12:15:54 2012 +0000 +++ b/Tests/Tests.h Thu Sep 06 13:35:25 2012 +0000 @@ -42,5 +42,6 @@ }; static const char* gTestDescriptions[] = { - gTest10Description + gTest10Description, + gTest12Description }; \ No newline at end of file