Vodafone Test Suite
Dependencies: mbed-rtos mbed HTTPClient VodafoneUSBModem
Tests/Test10.cpp
- Committer:
- ashleymills
- Date:
- 2012-09-17
- Revision:
- 44:6d0ac4747f5b
- Parent:
- 40:32b0558320ea
- Child:
- 53:54b2d3a0c7bf
File content as of revision 44:6d0ac4747f5b:
#include "Test10.h" Test10::Test10(VodafoneUSBModem *m) : VodafoneTestCase(m) { _description = gTest10Description; _testCaseNumber = 10; } void Test10::setupTest() {} bool Test10::executeTest() { HTTPClient http; char msgBuffer[125]; bool outcome = true; LOG("Description: %s",gTest10Description); LOG("Connecting to internet"); if(_modem->connect("internet","web","web")==0) { LOG("Connected to internet"); } else { LOG("Failed to connect to internet"); outcome = false; } LOG("Doing HTTP GET for http://www.m2mthings.com/test100.txt"); if(http.get("http://www.m2mthings.com/test100.txt", msgBuffer, 125)==0) { LOG("Got buffer"); char c = 0; for(int i=0; i<100; i++) { if(msgBuffer[i]!=c) { LOG("Strings do not match at char %d (%x,%x)",i,c,msgBuffer[i]); outcome = false; break; } c++; if(c==256) c = 0; } LOG("All bytes match! PASS."); } else { LOG("HTTP get failure"); outcome = false; } _modem->disconnect(); return outcome; } void Test10::endTest() { }