1 /*
2 * Tools output functions test program
3 *
4 * Copyright (C) 2010-2021, Joachim Metz <joachim.metz@gmail.com>
5 *
6 * Refer to AUTHORS for acknowledgements.
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 #include <common.h>
23 #include <file_stream.h>
24 #include <types.h>
25
26 #include <stdio.h>
27
28 #if defined( HAVE_IO_H ) || defined( WINAPI )
29 #include <io.h>
30 #endif
31
32 #if defined( HAVE_STDLIB_H ) || defined( WINAPI )
33 #include <stdlib.h>
34 #endif
35
36 #include "fsext_test_libcerror.h"
37 #include "fsext_test_macros.h"
38 #include "fsext_test_unused.h"
39
40 #include "../fsexttools/fsexttools_output.h"
41
42 /* Tests the fsexttools_output_initialize function
43 * Returns 1 if successful or 0 if not
44 */
fsext_test_tools_output_initialize(void)45 int fsext_test_tools_output_initialize(
46 void )
47 {
48 libcerror_error_t *error = NULL;
49 int result = 0;
50
51 result = fsexttools_output_initialize(
52 _IONBF,
53 &error );
54
55 FSEXT_TEST_ASSERT_EQUAL_INT(
56 "result",
57 result,
58 1 );
59
60 FSEXT_TEST_ASSERT_IS_NULL(
61 "error",
62 error );
63
64 return( 1 );
65
66 on_error:
67 if( error != NULL )
68 {
69 libcerror_error_free(
70 &error );
71 }
72 return( 0 );
73 }
74
75 /* The main program
76 */
77 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
wmain(int argc FSEXT_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]FSEXT_TEST_ATTRIBUTE_UNUSED)78 int wmain(
79 int argc FSEXT_TEST_ATTRIBUTE_UNUSED,
80 wchar_t * const argv[] FSEXT_TEST_ATTRIBUTE_UNUSED )
81 #else
82 int main(
83 int argc FSEXT_TEST_ATTRIBUTE_UNUSED,
84 char * const argv[] FSEXT_TEST_ATTRIBUTE_UNUSED )
85 #endif
86 {
87 FSEXT_TEST_UNREFERENCED_PARAMETER( argc )
88 FSEXT_TEST_UNREFERENCED_PARAMETER( argv )
89
90 FSEXT_TEST_RUN(
91 "fsexttools_output_initialize",
92 fsext_test_tools_output_initialize )
93
94 /* TODO add tests for fsexttools_output_copyright_fprint */
95
96 /* TODO add tests for fsexttools_output_version_fprint */
97
98 /* TODO add tests for fsexttools_output_version_detailed_fprint */
99
100 return( EXIT_SUCCESS );
101
102 on_error:
103 return( EXIT_FAILURE );
104 }
105
106