Tests for the NetworkSocketAPI
Dependents: BSDInterfaceTests ESP8266InterfaceTests LWIPInterfaceTests SpwfInterface_NSAPI_Tests ... more
Diff: NSAPITests.cpp
- Revision:
- 4:b52f17273177
- Parent:
- 3:8b595ee6219d
- Child:
- 5:03b0570b4c29
diff -r 8b595ee6219d -r b52f17273177 NSAPITests.cpp --- a/NSAPITests.cpp Wed Mar 02 16:16:25 2016 -0600 +++ b/NSAPITests.cpp Wed Mar 02 18:02:47 2016 -0600 @@ -101,7 +101,7 @@ int nsapi_socket_send_test(Socket *socket, const char *test_address, uint16_t test_port) { char data[] = "{{start}}"; - int32_t ret = socket->send(data, sizeof(data)); + int32_t ret = socket->send(data, strlen(data)); if (ret) { printf("'send' failed with code %d\r\n", ret); @@ -116,7 +116,7 @@ char expected_data[] = "{{data}}"; char data[100] = {0}; - int32_t ret = socket->send(data, sizeof(data)); + int32_t ret = socket->send(expected_data, strlen(expected_data)); if (ret) { printf("'send' failed during 'recv' test with code %d\r\n", ret); @@ -125,7 +125,7 @@ int32_t bytes_received = socket->recv(data, sizeof(data)); - if (bytes_received >= (int32_t)sizeof(expected_data)) { + if (bytes_received >= (int32_t)strlen(expected_data)) { if (strstr(data, expected_data) != NULL) { return 0; } else { @@ -148,7 +148,7 @@ char expected_data[] = "{{data}}"; char data[100] = {0}; - int32_t ret = socket->send(expected_data, sizeof(expected_data)); + int32_t ret = socket->send(expected_data, strlen(expected_data)); if (ret) { printf("'send' failed during 'recv' test with code %d\r\n", ret); @@ -158,7 +158,7 @@ for (int i = 0; i < 100; i++) { bytes_received = socket->recv(data, sizeof(data), false); - if (bytes_received >= (int32_t)sizeof(expected_data)) { + if (bytes_received >= (int32_t)strlen(expected_data)) { if (strstr(data, expected_data) != NULL) { result = 0; break;