Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
ashleymills
Date:
Tue Sep 04 15:31:55 2012 +0000
Revision:
20:18373fb68ad7
Child:
25:55b865c41f21
Added long USSD test.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 20:18373fb68ad7 1 #pragma once
ashleymills 20:18373fb68ad7 2 #include "Test23.h"
ashleymills 20:18373fb68ad7 3
ashleymills 20:18373fb68ad7 4 const char *Test23Description = "Test %d sending USSD over 150 chars \"0(0)00 ... 000(160)\"\0";
ashleymills 20:18373fb68ad7 5 const char *Test23USSDMessage = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\0";
ashleymills 20:18373fb68ad7 6
ashleymills 20:18373fb68ad7 7 Test23::Test23(VodafoneUSBModem *m, int tcNumber) : VodafoneTestCase(m, tcNumber) { }
ashleymills 20:18373fb68ad7 8
ashleymills 20:18373fb68ad7 9 // virtual
ashleymills 20:18373fb68ad7 10 void Test23::setupTest() {
ashleymills 20:18373fb68ad7 11 _ussdResponse = (char*)malloc(16*sizeof(char));
ashleymills 20:18373fb68ad7 12 }
ashleymills 20:18373fb68ad7 13
ashleymills 20:18373fb68ad7 14 // virtual
ashleymills 20:18373fb68ad7 15 bool Test23::runTest() {
ashleymills 20:18373fb68ad7 16
ashleymills 20:18373fb68ad7 17 LOG(Test23Description, _testCaseNumber);
ashleymills 20:18373fb68ad7 18
ashleymills 20:18373fb68ad7 19 if(_modem->sendUSSD(Test23USSDMessage,_ussdResponse,16)!=0) {
ashleymills 20:18373fb68ad7 20 LOG("Error sending USSD");
ashleymills 20:18373fb68ad7 21 return false;
ashleymills 20:18373fb68ad7 22 }
ashleymills 20:18373fb68ad7 23
ashleymills 20:18373fb68ad7 24 LOG("Expecting \"Unknown Command\". Received USSD response: \"%s\"",_ussdResponse);
ashleymills 20:18373fb68ad7 25 return (strcmp(_ussdResponse,"Unknown command")==0);
ashleymills 20:18373fb68ad7 26 }
ashleymills 20:18373fb68ad7 27
ashleymills 20:18373fb68ad7 28 // virtual
ashleymills 20:18373fb68ad7 29 void Test23::endTest() {
ashleymills 20:18373fb68ad7 30 free(_ussdResponse);
ashleymills 20:18373fb68ad7 31 }