Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
TestManager.cpp@16:c89d426c6175, 2012-08-30 (annotated)
- Committer:
- nherriot
- Date:
- Thu Aug 30 14:06:22 2012 +0000
- Revision:
- 16:c89d426c6175
- Parent:
- 13:8b69853966f8
- Child:
- 19:26fbed33d4e7
started working on other tc's.... small typos on log files .... still all works
Who changed what in which revision?
User | Revision | Line number | New 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) { |
nherriot | 13:8b69853966f8 | 4 | _tests.push_back((VodafoneTestCase*)new Test20(_modem, 20)); |
nherriot | 13:8b69853966f8 | 5 | _tests.push_back((VodafoneTestCase*)new Test12(_modem, 12)); |
nherriot | 16:c89d426c6175 | 6 | _tests.push_back((VodafoneTestCase*)new Test13(_modem, 13)); |
nherriot | 13:8b69853966f8 | 7 | // _tests.push_back((VodafoneTestCase*)new Test50(_modem, 50)); |
ashleymills | 2:ea883307d02f | 8 | } |
ashleymills | 2:ea883307d02f | 9 | |
ashleymills | 2:ea883307d02f | 10 | int TestManager::runAll() { |
ashleymills | 2:ea883307d02f | 11 | int successfullTests = 0; |
ashleymills | 2:ea883307d02f | 12 | LOG("Running %d tests...",_tests.size()); |
ashleymills | 2:ea883307d02f | 13 | for(int i=0; i<_tests.size(); i++) { |
ashleymills | 2:ea883307d02f | 14 | LOG("Running test %d...",i); |
ashleymills | 4:1f8e079924ba | 15 | if(_tests[i]->run()) { |
ashleymills | 2:ea883307d02f | 16 | LOG("...OK"); |
ashleymills | 2:ea883307d02f | 17 | successfullTests++; |
ashleymills | 2:ea883307d02f | 18 | } else { |
ashleymills | 2:ea883307d02f | 19 | LOG("...FAIL"); |
ashleymills | 2:ea883307d02f | 20 | } |
ashleymills | 2:ea883307d02f | 21 | } |
ashleymills | 2:ea883307d02f | 22 | return successfullTests; |
ashleymills | 2:ea883307d02f | 23 | } |
ashleymills | 2:ea883307d02f | 24 | |
ashleymills | 4:1f8e079924ba | 25 | bool TestManager::runTest(int id) { |
ashleymills | 4:1f8e079924ba | 26 | if(id<0||id>=_tests.size()) { |
ashleymills | 4:1f8e079924ba | 27 | LOG("Test ID must be between 0 and %d",_tests.size()); |
ashleymills | 4:1f8e079924ba | 28 | } |
ashleymills | 4:1f8e079924ba | 29 | return _tests[id]->run(); |
ashleymills | 4:1f8e079924ba | 30 | } |
ashleymills | 4:1f8e079924ba | 31 | |
ashleymills | 4:1f8e079924ba | 32 | |
ashleymills | 4:1f8e079924ba | 33 | bool TestManager::runTest(int id, int numTimes) { |
ashleymills | 4:1f8e079924ba | 34 | for(int i=0; i<numTimes; i++) { |
ashleymills | 4:1f8e079924ba | 35 | if(!runTest(id)) |
ashleymills | 4:1f8e079924ba | 36 | return false; |
ashleymills | 4:1f8e079924ba | 37 | } |
ashleymills | 4:1f8e079924ba | 38 | return true; |
ashleymills | 4:1f8e079924ba | 39 | } |
ashleymills | 4:1f8e079924ba | 40 | |
ashleymills | 2:ea883307d02f | 41 | int TestManager::getNumTests() { |
ashleymills | 2:ea883307d02f | 42 | return _tests.size(); |
ashleymills | 2:ea883307d02f | 43 | } |