forked from nasa/osal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix nasa#379, Add FileSysAddFixedMap functional API test
- Loading branch information
1 parent
3604387
commit 54bc184
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
src/tests/file-sys-add-fixed-map-api-test/file-sys-add-fixed-map-api-test.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Copyright (c) 2020, United States government as represented by the | ||
* administrator of the National Aeronautics Space Administration. | ||
* All rights reserved. This software was created at NASA Goddard | ||
* Space Flight Center pursuant to government contracts. | ||
* | ||
* This is governed by the NASA Open Source Agreement and may be used, | ||
* distributed and modified only according to the terms of that agreement. | ||
*/ | ||
|
||
/* | ||
* Filename: file-sys-add-fixed-map-api-test.c | ||
* | ||
* Purpose: This file contains functional tests for "osapi-FileSysAddFixedMap" | ||
* | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdlib.h> | ||
|
||
#include "common_types.h" | ||
#include "osapi.h" | ||
#include "utassert.h" | ||
#include "uttest.h" | ||
#include "utbsp.h" | ||
|
||
|
||
|
||
|
||
/* *************************************** MAIN ************************************** */ | ||
|
||
void TestFileSysAddFixedMapApi(void) | ||
{ | ||
int32 expected; | ||
int32 actual; | ||
uint32 fs_id; | ||
|
||
/* Test for nominal inputs */ | ||
/* | ||
* This test case requires a fixed virtual dir for one test case. | ||
* Just map /test to a dir of the same name, relative to current dir. | ||
*/ | ||
|
||
expected = OS_SUCCESS; | ||
actual = OS_FileSysAddFixedMap(&fs_id, "./test", "/test"); | ||
UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); | ||
|
||
/* Test for invalid inputs */ | ||
expected = OS_INVALID_POINTER; | ||
actual = OS_FileSysAddFixedMap(NULL, NULL, NULL); | ||
UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); | ||
|
||
expected = OS_INVALID_POINTER; | ||
actual = OS_FileSysAddFixedMap(&fs_id, NULL, NULL); | ||
UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); | ||
|
||
expected = OS_INVALID_POINTER; | ||
actual = OS_FileSysAddFixedMap(&fs_id, "./test", NULL); | ||
UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); | ||
|
||
|
||
} /* end TestFileSysAddFixedMapApi */ | ||
|
||
|
||
void UtTest_Setup(void) | ||
{ | ||
if (OS_API_Init() != OS_SUCCESS) | ||
{ | ||
UtAssert_Abort("OS_API_Init() failed"); | ||
} | ||
|
||
/* | ||
* Register the test setup and check routines in UT assert | ||
*/ | ||
UtTest_Add(TestFileSysAddFixedMapApi, NULL, NULL, "TestFileSysAddFixedMapApi"); | ||
} | ||
|