Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Committer:
nherriot
Date:
Thu Aug 23 16:02:34 2012 +0000
Revision:
7:ec0db221f897
Parent:
4:1f8e079924ba
Child:
9:3ff68422f4d7
updating Nick's test case 12 for receiving SMS message.....

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ashleymills 2:ea883307d02f 1 #include "TestManager.h"
ashleymills 3:28336c2e94e4 2 #include "Tests.h"
ashleymills 2:ea883307d02f 3 TestManager::TestManager(VodafoneUSBModem *m) : _modem(m) {
ashleymills 3:28336c2e94e4 4 _tests.push_back((VodafoneTestCase*)new Test20(_modem));
nherriot 7:ec0db221f897 5 _tests.push_back((VodafoneTestCase*)new Test12(_modem));
ashleymills 2:ea883307d02f 6 }
ashleymills 2:ea883307d02f 7
ashleymills 2:ea883307d02f 8 int TestManager::runAll() {
ashleymills 2:ea883307d02f 9 int successfullTests = 0;
ashleymills 2:ea883307d02f 10 LOG("Running %d tests...",_tests.size());
ashleymills 2:ea883307d02f 11 for(int i=0; i<_tests.size(); i++) {
ashleymills 2:ea883307d02f 12 LOG("Running test %d...",i);
ashleymills 4:1f8e079924ba 13 if(_tests[i]->run()) {
ashleymills 2:ea883307d02f 14 LOG("...OK");
ashleymills 2:ea883307d02f 15 successfullTests++;
ashleymills 2:ea883307d02f 16 } else {
ashleymills 2:ea883307d02f 17 LOG("...FAIL");
ashleymills 2:ea883307d02f 18 }
ashleymills 2:ea883307d02f 19 }
ashleymills 2:ea883307d02f 20 return successfullTests;
ashleymills 2:ea883307d02f 21 }
ashleymills 2:ea883307d02f 22
ashleymills 4:1f8e079924ba 23 bool TestManager::runTest(int id) {
ashleymills 4:1f8e079924ba 24 if(id<0||id>=_tests.size()) {
ashleymills 4:1f8e079924ba 25 LOG("Test ID must be between 0 and %d",_tests.size());
ashleymills 4:1f8e079924ba 26 }
ashleymills 4:1f8e079924ba 27 return _tests[id]->run();
ashleymills 4:1f8e079924ba 28 }
ashleymills 4:1f8e079924ba 29
ashleymills 4:1f8e079924ba 30
ashleymills 4:1f8e079924ba 31 bool TestManager::runTest(int id, int numTimes) {
ashleymills 4:1f8e079924ba 32 for(int i=0; i<numTimes; i++) {
ashleymills 4:1f8e079924ba 33 if(!runTest(id))
ashleymills 4:1f8e079924ba 34 return false;
ashleymills 4:1f8e079924ba 35 }
ashleymills 4:1f8e079924ba 36 return true;
ashleymills 4:1f8e079924ba 37 }
ashleymills 4:1f8e079924ba 38
ashleymills 2:ea883307d02f 39 int TestManager::getNumTests() {
ashleymills 2:ea883307d02f 40 return _tests.size();
ashleymills 2:ea883307d02f 41 }