1 /*
2  * Library error functions test program
3  *
4  * Copyright (C) 2011-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 "bde_test_libbde.h"
31 #include "bde_test_macros.h"
32 #include "bde_test_unused.h"
33 
34 /* Tests the libbde_error_free function
35  * Returns 1 if successful or 0 if not
36  */
bde_test_error_free(void)37 int bde_test_error_free(
38      void )
39 {
40 	/* Test invocation of function only
41 	 */
42 	libbde_error_free(
43 	 NULL );
44 
45 	return( 1 );
46 }
47 
48 /* Tests the libbde_error_fprint function
49  * Returns 1 if successful or 0 if not
50  */
bde_test_error_fprint(void)51 int bde_test_error_fprint(
52      void )
53 {
54 	/* Test invocation of function only
55 	 */
56 	libbde_error_fprint(
57 	 NULL,
58 	 NULL );
59 
60 	return( 1 );
61 }
62 
63 /* Tests the libbde_error_sprint function
64  * Returns 1 if successful or 0 if not
65  */
bde_test_error_sprint(void)66 int bde_test_error_sprint(
67      void )
68 {
69 	/* Test invocation of function only
70 	 */
71 	libbde_error_sprint(
72 	 NULL,
73 	 NULL,
74 	 0 );
75 
76 	return( 1 );
77 }
78 
79 /* Tests the libbde_error_backtrace_fprint function
80  * Returns 1 if successful or 0 if not
81  */
bde_test_error_backtrace_fprint(void)82 int bde_test_error_backtrace_fprint(
83      void )
84 {
85 	/* Test invocation of function only
86 	 */
87 	libbde_error_backtrace_fprint(
88 	 NULL,
89 	 NULL );
90 
91 	return( 1 );
92 }
93 
94 /* Tests the libbde_error_backtrace_sprint function
95  * Returns 1 if successful or 0 if not
96  */
bde_test_error_backtrace_sprint(void)97 int bde_test_error_backtrace_sprint(
98      void )
99 {
100 	/* Test invocation of function only
101 	 */
102 	libbde_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 BDE_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]BDE_TEST_ATTRIBUTE_UNUSED)113 int wmain(
114      int argc BDE_TEST_ATTRIBUTE_UNUSED,
115      wchar_t * const argv[] BDE_TEST_ATTRIBUTE_UNUSED )
116 #else
117 int main(
118      int argc BDE_TEST_ATTRIBUTE_UNUSED,
119      char * const argv[] BDE_TEST_ATTRIBUTE_UNUSED )
120 #endif
121 {
122 	BDE_TEST_UNREFERENCED_PARAMETER( argc )
123 	BDE_TEST_UNREFERENCED_PARAMETER( argv )
124 
125 	BDE_TEST_RUN(
126 	 "libbde_error_free",
127 	 bde_test_error_free );
128 
129 	BDE_TEST_RUN(
130 	 "libbde_error_fprint",
131 	 bde_test_error_fprint );
132 
133 	BDE_TEST_RUN(
134 	 "libbde_error_sprint",
135 	 bde_test_error_sprint );
136 
137 	BDE_TEST_RUN(
138 	 "libbde_error_backtrace_fprint",
139 	 bde_test_error_backtrace_fprint );
140 
141 	BDE_TEST_RUN(
142 	 "libbde_error_backtrace_sprint",
143 	 bde_test_error_backtrace_sprint );
144 
145 	return( EXIT_SUCCESS );
146 
147 on_error:
148 	return( EXIT_FAILURE );
149 }
150 
151