Tests for the NetworkSocketAPI
Dependents: BSDInterfaceTests ESP8266InterfaceTests LWIPInterfaceTests SpwfInterface_NSAPI_Tests ... more
Diff: NSAPITests.cpp
- Revision:
- 9:07b22947be75
- Parent:
- 8:5a5c498e1fa0
- Child:
- 10:0d938ec9100c
--- a/NSAPITests.cpp Thu Mar 03 20:39:45 2016 +0000 +++ b/NSAPITests.cpp Thu Mar 03 21:04:29 2016 +0000 @@ -124,7 +124,7 @@ int32_t bytes_received = socket->recv(received_data, sizeof(received_data)); if (bytes_received >= (int32_t)data_size) { - if (strstr(received_data, expected_data) != NULL) { + if (memcmp(received_data, expected_data, data_size) == 0) { return 0; } else { printf("'recv' returned incorrect data with length %d\r\n", bytes_received); @@ -193,7 +193,7 @@ bytes_received = socket->recv(received_data, data_size, false); if (bytes_received >= (int32_t)data_size) { - if (strstr(received_data, expected_data) != NULL) { + if (memcmp(received_data, expected_data, data_size) == 0) { result = 0; break; } else { @@ -209,7 +209,7 @@ if (result == -1) { printf("'recv' returned no data\r\n"); } else if (result == -2) { - printf("'recv' returned incorrect data\r\n"); + printf("'recv' returned incorrect data with length %d\r\n", bytes_received); } else if (result == -3) { printf("'recv' failed with code %d\r\n", bytes_received); }