Skip to content

Commit

Permalink
Fix nasa#929, use test function for osal_id_t
Browse files Browse the repository at this point in the history
Do not initialize or compare osal_id_t directly to integers,
use the provided comparison function.
  • Loading branch information
jphickey committed Mar 25, 2021
1 parent 53f7f61 commit c24bee1
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/tests/file-api-test/file-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,9 @@ void TestCreatRemove(void)
UtAssert_True(status == OS_SUCCESS, "status after remove max name length file = %d", (int)status);

/* try creating with file name too big, should fail */
fd = ~OS_OBJECT_ID_UNDEFINED;
status = OS_OpenCreate(&fd, longfilename, OS_FILE_FLAG_CREATE | OS_FILE_FLAG_TRUNCATE, OS_READ_WRITE);
UtAssert_True(status < OS_SUCCESS, "status after create file name too long = %d", (int)status);
UtAssert_UINT32_EQ(fd, OS_OBJECT_ID_UNDEFINED);
UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED");

/* try removing with file name too big. Should Fail */
status = OS_remove(longfilename);
Expand Down Expand Up @@ -235,10 +234,9 @@ void TestOpenClose(void)
UtAssert_True(status != OS_SUCCESS, "status after close = %d", (int)status);

/* open a file that was never in the system */
fd = ~OS_OBJECT_ID_UNDEFINED;
status = OS_OpenCreate(&fd, "/drive0/FileNotHere", OS_FILE_FLAG_NONE, OS_READ_ONLY);
UtAssert_True(status < OS_SUCCESS, "status after open = %d", (int)status);
UtAssert_UINT32_EQ(fd, OS_OBJECT_ID_UNDEFINED);
UtAssert_True(!OS_ObjectIdDefined(fd), "fd == OS_OBJECT_ID_UNDEFINED");

/* try removing the file from the drive to end the function */
status = OS_remove(filename);
Expand Down

0 comments on commit c24bee1

Please sign in to comment.