Debian Codegraph @

tests/vhdi_test_tools_output.c

raw symbols SCIP
1 /*
2 * Tools output functions test program
3 *
4 * Copyright (C) 2012-2025, Joachim Metz <[email protected]>
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 "vhdi_test_libcerror.h"
37 #include "vhdi_test_macros.h"
38 #include "vhdi_test_unused.h"
39
40 #include "../vhditools/vhditools_output.h"
41
42 /* Tests the vhditools_output_initialize function
43 * Returns 1 if successful or 0 if not
44 */
45 int vhdi_test_tools_output_initialize(
46 void )
47 {
48 libcerror_error_t *error = NULL;
49 int result = 0;
50
51 result = vhditools_output_initialize(
52 _IONBF,
53 &error );
54
55 VHDI_TEST_ASSERT_EQUAL_INT(
56 "result",
57 result,
58 1 );
59
60 VHDI_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 )
78 int wmain(
79 int argc VHDI_TEST_ATTRIBUTE_UNUSED,
80 wchar_t * const argv[] VHDI_TEST_ATTRIBUTE_UNUSED )
81 #else
82 int main(
83 int argc VHDI_TEST_ATTRIBUTE_UNUSED,
84 char * const argv[] VHDI_TEST_ATTRIBUTE_UNUSED )
85 #endif
86 {
87 VHDI_TEST_UNREFERENCED_PARAMETER( argc )
88 VHDI_TEST_UNREFERENCED_PARAMETER( argv )
89
90 VHDI_TEST_RUN(
91 "vhditools_output_initialize",
92 vhdi_test_tools_output_initialize )
93
94 /* TODO add tests for vhditools_output_copyright_fprint */
95
96 /* TODO add tests for vhditools_output_version_fprint */
97
98 /* TODO add tests for vhditools_output_version_detailed_fprint */
99
100 return( EXIT_SUCCESS );
101
102 on_error:
103 return( EXIT_FAILURE );
104 }
105