|
| 1 | +/* |
| 2 | + * Copyright (c) 2020, United States government as represented by the |
| 3 | + * administrator of the National Aeronautics Space Administration. |
| 4 | + * All rights reserved. This software was created at NASA Goddard |
| 5 | + * Space Flight Center pursuant to government contracts. |
| 6 | + * |
| 7 | + * This is governed by the NASA Open Source Agreement and may be used, |
| 8 | + * distributed and modified only according to the terms of that agreement. |
| 9 | + */ |
| 10 | + |
| 11 | +/* |
| 12 | + * Filename: file-sys-add-fixed-map-api-test.c |
| 13 | + * |
| 14 | + * Purpose: This file contains functional tests for "osapi-FileSysAddFixedMap" |
| 15 | + * |
| 16 | + */ |
| 17 | + |
| 18 | +#include <stdio.h> |
| 19 | +#include <string.h> |
| 20 | +#include <stdlib.h> |
| 21 | + |
| 22 | +#include "common_types.h" |
| 23 | +#include "osapi.h" |
| 24 | +#include "utassert.h" |
| 25 | +#include "uttest.h" |
| 26 | +#include "utbsp.h" |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | +/* *************************************** MAIN ************************************** */ |
| 32 | + |
| 33 | +void TestFileSysAddFixedMapApi(void) |
| 34 | +{ |
| 35 | + int32 expected; |
| 36 | + int32 actual; |
| 37 | + uint32 fs_id; |
| 38 | + |
| 39 | + /* Test for nominal inputs */ |
| 40 | + /* |
| 41 | + * This test case requires a fixed virtual dir for one test case. |
| 42 | + * Just map /test to a dir of the same name, relative to current dir. |
| 43 | + */ |
| 44 | + |
| 45 | + expected = OS_SUCCESS; |
| 46 | + actual = OS_FileSysAddFixedMap(&fs_id, "./test", "/test"); |
| 47 | + UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); |
| 48 | + |
| 49 | + /* Test for invalid inputs */ |
| 50 | + expected = OS_INVALID_POINTER; |
| 51 | + actual = OS_FileSysAddFixedMap(NULL, NULL, NULL); |
| 52 | + UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); |
| 53 | + |
| 54 | + expected = OS_INVALID_POINTER; |
| 55 | + actual = OS_FileSysAddFixedMap(&fs_id, NULL, NULL); |
| 56 | + UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); |
| 57 | + |
| 58 | + expected = OS_INVALID_POINTER; |
| 59 | + actual = OS_FileSysAddFixedMap(&fs_id, "./test", NULL); |
| 60 | + UtAssert_True(actual == expected, "OS_FileSysAddFixedMap() (%ld) == OS_SUCCESS", (long)actual); |
| 61 | + |
| 62 | + |
| 63 | +} /* end TestFileSysAddFixedMapApi */ |
| 64 | + |
| 65 | + |
| 66 | +void UtTest_Setup(void) |
| 67 | +{ |
| 68 | + if (OS_API_Init() != OS_SUCCESS) |
| 69 | + { |
| 70 | + UtAssert_Abort("OS_API_Init() failed"); |
| 71 | + } |
| 72 | + |
| 73 | + /* |
| 74 | + * Register the test setup and check routines in UT assert |
| 75 | + */ |
| 76 | + UtTest_Add(TestFileSysAddFixedMapApi, NULL, NULL, "TestFileSysAddFixedMapApi"); |
| 77 | +} |
| 78 | + |
0 commit comments