From 4b65be018e9b95c1fae6f11b4eb8a940eae31d9f Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Tue, 5 Jan 2021 14:15:52 -0500 Subject: [PATCH 1/2] Fix #692, Resolve typos in unit test assert OR statements --- src/tests/network-api-test/network-api-test.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tests/network-api-test/network-api-test.c b/src/tests/network-api-test/network-api-test.c index 019bbdb9b..58da01a02 100644 --- a/src/tests/network-api-test/network-api-test.c +++ b/src/tests/network-api-test/network-api-test.c @@ -113,7 +113,8 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketOpen */ actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM); - UtAssert_True(actual == OS_SUCCESS || OS_ERR_NOT_IMPLEMENTED, "OS_SocketOpen() (%ld) Passed", (long)actual); + UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketOpen() (%ld) Passed", (long)actual); OS_close(socket_id); expected = OS_INVALID_POINTER; @@ -126,12 +127,12 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketAddrInit */ actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_SUCCESS || OS_ERR_NOT_IMPLEMENTED, "OS_SocketAddrInit() (%ld) == OS_SUCCESS", - (long)actual); + UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_INVALID_POINTER || OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + UtAssert_True(actual == OS_INVALID_POINTER || actual == OS_ERR_NOT_IMPLEMENTED, + "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); expected = OS_ERR_NOT_IMPLEMENTED; actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INVALID); From a92873480f3e4d84fed66bb8bff5f2723211f72f Mon Sep 17 00:00:00 2001 From: Alex Campbell Date: Mon, 11 Jan 2021 14:46:10 -0500 Subject: [PATCH 2/2] Fix #692, display message when not implemented error occurs --- src/tests/network-api-test/network-api-test.c | 30 +++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/tests/network-api-test/network-api-test.c b/src/tests/network-api-test/network-api-test.c index 58da01a02..891bcb6d8 100644 --- a/src/tests/network-api-test/network-api-test.c +++ b/src/tests/network-api-test/network-api-test.c @@ -113,8 +113,14 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketOpen */ actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM); - UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketOpen() (%ld) Passed", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_SUCCESS, "OS_SocketOpen() (%ld) Passed", (long)actual); + } OS_close(socket_id); expected = OS_INVALID_POINTER; @@ -127,12 +133,24 @@ void TestDatagramNetworkApi_Setup(void) /* OS_SocketAddrInit */ actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_SUCCESS || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_SUCCESS, "OS_SocketAddrInit() (%ld) == OS_SUCCESS", (long)actual); + } actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INET6); - UtAssert_True(actual == OS_INVALID_POINTER || actual == OS_ERR_NOT_IMPLEMENTED, - "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + if (actual == OS_ERR_NOT_IMPLEMENTED) + { + UtPrintf("INET6 not supported\n"); + } + else + { + UtAssert_True(actual == OS_INVALID_POINTER, "OS_SocketAddrInit() (%ld) == OS_INVALID_POINTER", (long)actual); + } expected = OS_ERR_NOT_IMPLEMENTED; actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INVALID);