Skip to content

Commit

Permalink
Partial nasa#1052, Module test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
jphickey committed Jun 8, 2021
1 parent f70f3dc commit 16f40db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions src/unit-tests/osloader-test/ut_osloader_module_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ void UT_os_module_unload_test()
/* #1 Invalid-ID-arg */

UT_RETVAL(OS_ModuleUnload(UT_OBJID_INCORRECT), OS_ERR_INVALID_ID);
UT_RETVAL(OS_ModuleUnload(OS_OBJECT_ID_UNDEFINED), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #2 OS-call-failure */
Expand Down Expand Up @@ -224,6 +225,7 @@ void UT_os_module_info_test()
/* #2 Invalid-ID-arg */

UT_RETVAL(OS_ModuleInfo(UT_OBJID_INCORRECT, &module_info), OS_ERR_INVALID_ID);
UT_RETVAL(OS_ModuleInfo(OS_OBJECT_ID_UNDEFINED, &module_info), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* #3 Nominal */
Expand Down
17 changes: 9 additions & 8 deletions src/unit-tests/osloader-test/ut_osloader_symtable_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,22 +129,23 @@ void UT_os_module_symbol_lookup_test()
}

/*-----------------------------------------------------*/
/* #1 Invalid-pointer-arg-1 */

UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, 0, "Sym"), OS_INVALID_POINTER);

/*-----------------------------------------------------*/
/* #2 Invalid-pointer-arg-2 */
/* Invalid object ID */

UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symbol_addr, 0), OS_INVALID_POINTER);
UT_RETVAL(OS_ModuleSymbolLookup(OS_OBJECT_ID_UNDEFINED, &symbol_addr, "Sym"), OS_ERR_INVALID_ID);
UT_RETVAL(OS_ModuleSymbolLookup(UT_OBJID_INCORRECT, &symbol_addr, "Sym"), OS_ERR_INVALID_ID);

/*-----------------------------------------------------*/
/* Setup for remainder of tests */
if (UT_SETUP(OS_ModuleLoad(&module_id, "Mod1", UT_OS_GENERIC_MODULE_NAME2, OS_MODULE_FLAG_LOCAL_SYMBOLS)))
{
/*-----------------------------------------------------*/
/* #3 Symbol-not-found */
/* #1 Invalid-pointer-arg */

UT_RETVAL(OS_ModuleSymbolLookup(module_id, NULL, "Sym"), OS_INVALID_POINTER);
UT_RETVAL(OS_ModuleSymbolLookup(module_id, &symbol_addr, NULL), OS_INVALID_POINTER);

/*-----------------------------------------------------*/
/* #3 Symbol-not-found */
UT_RETVAL(OS_ModuleSymbolLookup(module_id, &symbol_addr, "NotFound"), OS_ERROR);

/*-----------------------------------------------------*/
Expand Down

0 comments on commit 16f40db

Please sign in to comment.