1 /*
2  * Library error functions test program
3  *
4  * Copyright (C) 2018-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 #if defined( HAVE_STDLIB_H ) || defined( WINAPI )
27 #include <stdlib.h>
28 #endif
29 
30 #include "fsapfs_test_libfsapfs.h"
31 #include "fsapfs_test_macros.h"
32 #include "fsapfs_test_unused.h"
33 
34 /* Tests the libfsapfs_error_free function
35  * Returns 1 if successful or 0 if not
36  */
fsapfs_test_error_free(void)37 int fsapfs_test_error_free(
38      void )
39 {
40 	/* Test invocation of function only
41 	 */
42 	libfsapfs_error_free(
43 	 NULL );
44 
45 	return( 1 );
46 }
47 
48 /* Tests the libfsapfs_error_fprint function
49  * Returns 1 if successful or 0 if not
50  */
fsapfs_test_error_fprint(void)51 int fsapfs_test_error_fprint(
52      void )
53 {
54 	/* Test invocation of function only
55 	 */
56 	libfsapfs_error_fprint(
57 	 NULL,
58 	 NULL );
59 
60 	return( 1 );
61 }
62 
63 /* Tests the libfsapfs_error_sprint function
64  * Returns 1 if successful or 0 if not
65  */
fsapfs_test_error_sprint(void)66 int fsapfs_test_error_sprint(
67      void )
68 {
69 	/* Test invocation of function only
70 	 */
71 	libfsapfs_error_sprint(
72 	 NULL,
73 	 NULL,
74 	 0 );
75 
76 	return( 1 );
77 }
78 
79 /* Tests the libfsapfs_error_backtrace_fprint function
80  * Returns 1 if successful or 0 if not
81  */
fsapfs_test_error_backtrace_fprint(void)82 int fsapfs_test_error_backtrace_fprint(
83      void )
84 {
85 	/* Test invocation of function only
86 	 */
87 	libfsapfs_error_backtrace_fprint(
88 	 NULL,
89 	 NULL );
90 
91 	return( 1 );
92 }
93 
94 /* Tests the libfsapfs_error_backtrace_sprint function
95  * Returns 1 if successful or 0 if not
96  */
fsapfs_test_error_backtrace_sprint(void)97 int fsapfs_test_error_backtrace_sprint(
98      void )
99 {
100 	/* Test invocation of function only
101 	 */
102 	libfsapfs_error_backtrace_sprint(
103 	 NULL,
104 	 NULL,
105 	 0 );
106 
107 	return( 1 );
108 }
109 
110 /* The main program
111  */
112 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
wmain(int argc FSAPFS_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]FSAPFS_TEST_ATTRIBUTE_UNUSED)113 int wmain(
114      int argc FSAPFS_TEST_ATTRIBUTE_UNUSED,
115      wchar_t * const argv[] FSAPFS_TEST_ATTRIBUTE_UNUSED )
116 #else
117 int main(
118      int argc FSAPFS_TEST_ATTRIBUTE_UNUSED,
119      char * const argv[] FSAPFS_TEST_ATTRIBUTE_UNUSED )
120 #endif
121 {
122 	FSAPFS_TEST_UNREFERENCED_PARAMETER( argc )
123 	FSAPFS_TEST_UNREFERENCED_PARAMETER( argv )
124 
125 	FSAPFS_TEST_RUN(
126 	 "libfsapfs_error_free",
127 	 fsapfs_test_error_free );
128 
129 	FSAPFS_TEST_RUN(
130 	 "libfsapfs_error_fprint",
131 	 fsapfs_test_error_fprint );
132 
133 	FSAPFS_TEST_RUN(
134 	 "libfsapfs_error_sprint",
135 	 fsapfs_test_error_sprint );
136 
137 	FSAPFS_TEST_RUN(
138 	 "libfsapfs_error_backtrace_fprint",
139 	 fsapfs_test_error_backtrace_fprint );
140 
141 	FSAPFS_TEST_RUN(
142 	 "libfsapfs_error_backtrace_sprint",
143 	 fsapfs_test_error_backtrace_sprint );
144 
145 	return( EXIT_SUCCESS );
146 
147 on_error:
148 	return( EXIT_FAILURE );
149 }
150 
151