Skip to content

Commit

Permalink
Merge pull request #914 from zanzaben/fix752_uniform_not_implemented_…
Browse files Browse the repository at this point in the history
…tests

Fix #752, Utilize UTASSERT_CASETYPE_NA to report OS_ERR_NOT_IMPLEMENTED
  • Loading branch information
astrogeco committed Mar 18, 2021
2 parents 63672f2 + 4a21edb commit ddd8f27
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 18 deletions.
6 changes: 3 additions & 3 deletions src/tests/file-api-test/file-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void TestChmod(void)
}
else
{
UtPrintf("OS_chmod not implemented for write only\n");
UtAssert_NA("OS_chmod not implemented for write only");
}

/*Testing Read Only */
Expand All @@ -289,7 +289,7 @@ void TestChmod(void)
}
else
{
UtPrintf("OS_chmod not implemented for read only\n");
UtAssert_NA("OS_chmod not implemented for read only");
}

/*Testing Read Write */
Expand All @@ -304,7 +304,7 @@ void TestChmod(void)
}
else
{
UtPrintf("OS_chmod not implemented for read write\n");
UtAssert_NA("OS_chmod not implemented for read write");
}

/*Removing the file */
Expand Down
10 changes: 5 additions & 5 deletions src/tests/network-api-test/network-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void TestDatagramNetworkApi_Setup(void)
actual = OS_SocketOpen(&socket_id, OS_SocketDomain_INET6, OS_SocketType_DATAGRAM);
if (actual == OS_ERR_NOT_IMPLEMENTED)
{
UtPrintf("INET6 not supported\n");
UtAssert_NA("INET6 not supported");
}
else
{
Expand All @@ -142,7 +142,7 @@ void TestDatagramNetworkApi_Setup(void)
actual = OS_SocketAddrInit(&addr, OS_SocketDomain_INET6);
if (actual == OS_ERR_NOT_IMPLEMENTED)
{
UtPrintf("INET6 not supported\n");
UtAssert_NA("INET6 not supported");
}
else
{
Expand All @@ -152,7 +152,7 @@ void TestDatagramNetworkApi_Setup(void)
actual = OS_SocketAddrInit(NULL, OS_SocketDomain_INET6);
if (actual == OS_ERR_NOT_IMPLEMENTED)
{
UtPrintf("INET6 not supported\n");
UtAssert_NA("INET6 not supported");
}
else
{
Expand Down Expand Up @@ -378,7 +378,7 @@ void TestDatagramNetworkApi(void)
}
else
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}

} /* end TestDatagramNetworkApi */
Expand Down Expand Up @@ -466,7 +466,7 @@ void TestStreamNetworkApi(void)
actual = OS_SocketOpen(&s_socket_id, OS_SocketDomain_INET, OS_SocketType_STREAM);
if (actual == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions src/tests/select-test/select-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void TestSelectSingleRead(void)
}
else
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}
}

Expand Down Expand Up @@ -396,7 +396,7 @@ void TestSelectMultipleRead(void)
}
else
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}
}

Expand Down Expand Up @@ -467,7 +467,7 @@ void TestSelectSingleWrite(void)
}
else
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}
}

Expand Down Expand Up @@ -548,7 +548,7 @@ void TestSelectMultipleWrite(void)
}
else
{
UtAssert_Type(NA, false, "Network API not implemented");
UtAssert_NA("Network API not implemented");
}
}

Expand Down
30 changes: 24 additions & 6 deletions src/tests/symbol-api-test/symbol-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,42 @@ void TestSymbolApi(void)
*/
UtPrintf("Dumping symbol table with a limit of 32768 bytes\n");
status = OS_SymbolTableDump("/ram/SymbolTable32k.dat", 32768);
UtAssert_True(status == OS_SUCCESS || status == OS_ERR_NOT_IMPLEMENTED, "status after 32k OS_SymbolTableDump = %d",
(int)status);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
}
else
{
UtAssert_True(status == OS_SUCCESS, "status after 32k OS_SymbolTableDump = %d", (int)status);
}

/*
** dump the symbol table with a 128k byte limit
*/
UtPrintf("Dumping symbol table with a limit of 131072 bytes\n");
status = OS_SymbolTableDump("/ram/SymbolTable128k.dat", 131072);
UtAssert_True(status == OS_SUCCESS || status == OS_ERR_NOT_IMPLEMENTED, "status after 128k OS_SymbolTableDump = %d",
(int)status);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
}
else
{
UtAssert_True(status == OS_SUCCESS, "status after 128k OS_SymbolTableDump = %d", (int)status);
}

/*
** dump the symbol table with a 512k byte limit
*/
UtPrintf("Dumping symbol table with a limit of 524288 bytes\n");
status = OS_SymbolTableDump("/ram/SymbolTable512k.dat", 524288);
UtAssert_True(status == OS_SUCCESS || status == OS_ERR_NOT_IMPLEMENTED, "status after 512k OS_SymbolTableDump = %d",
(int)status);
if (status == OS_ERR_NOT_IMPLEMENTED)
{
UtAssert_NA("Module API not implemented");
}
else
{
UtAssert_True(status == OS_SUCCESS, "status after 512k OS_SymbolTableDump = %d", (int)status);
}

/*
** Test the symbol lookup
Expand Down
3 changes: 3 additions & 0 deletions ut_assert/inc/utassert.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ typedef struct
/* Asserts a test failure */
#define UtAssert_Failed(...) UtAssertEx(false, UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__)

/* Assert a test Not Applicable */
#define UtAssert_NA(...) UtAssertEx(false, UTASSERT_CASETYPE_NA, __FILE__, __LINE__, __VA_ARGS__)

/* Compares two integers and determines if they are equal within a specified absolute tolerance. */
#define UtAssert_IntegerCmpAbs(x, y, Tolerance, ...) \
UtAssertEx((abs((x) - (y)) <= (Tolerance)), UtAssert_GetContext(), __FILE__, __LINE__, __VA_ARGS__)
Expand Down

0 comments on commit ddd8f27

Please sign in to comment.