Vodafone Test Suite

Dependencies:   mbed-rtos mbed HTTPClient VodafoneUSBModem

Revision:
40:32b0558320ea
Child:
44:6d0ac4747f5b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Tests/Test10.cpp	Fri Sep 14 12:16:09 2012 +0000
@@ -0,0 +1,46 @@
+#include "Test10.h"
+
+Test10::Test10(VodafoneUSBModem *m) : VodafoneTestCase(m) {
+   _description = gTest10Description;
+   _testCaseNumber = 10;
+}
+      
+void Test10::setupTest() {}
+   
+bool Test10::execute() {
+   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() { }
\ No newline at end of file