1 /*
2  * Library bands_data_handle type test program
3  *
4  * Copyright (C) 2012-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 "modi_test_libcerror.h"
31 #include "modi_test_libmodi.h"
32 #include "modi_test_macros.h"
33 #include "modi_test_memory.h"
34 #include "modi_test_unused.h"
35 
36 #include "../libmodi/libmodi_bands_data_handle.h"
37 
38 #if defined( __GNUC__ ) && !defined( LIBMODI_DLL_IMPORT )
39 
40 /* Tests the libmodi_bands_data_handle_free function
41  * Returns 1 if successful or 0 if not
42  */
modi_test_bands_data_handle_free(void)43 int modi_test_bands_data_handle_free(
44      void )
45 {
46 	libcerror_error_t *error = NULL;
47 	int result               = 0;
48 
49 	/* Test error cases
50 	 */
51 	result = libmodi_bands_data_handle_free(
52 	          NULL,
53 	          &error );
54 
55 	MODI_TEST_ASSERT_EQUAL_INT(
56 	 "result",
57 	 result,
58 	 -1 );
59 
60 	MODI_TEST_ASSERT_IS_NOT_NULL(
61 	 "error",
62 	 error );
63 
64 	libcerror_error_free(
65 	 &error );
66 
67 	return( 1 );
68 
69 on_error:
70 	if( error != NULL )
71 	{
72 		libcerror_error_free(
73 		 &error );
74 	}
75 	return( 0 );
76 }
77 
78 #endif /* defined( __GNUC__ ) && !defined( LIBMODI_DLL_IMPORT ) */
79 
80 /* The main program
81  */
82 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
wmain(int argc MODI_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]MODI_TEST_ATTRIBUTE_UNUSED)83 int wmain(
84      int argc MODI_TEST_ATTRIBUTE_UNUSED,
85      wchar_t * const argv[] MODI_TEST_ATTRIBUTE_UNUSED )
86 #else
87 int main(
88      int argc MODI_TEST_ATTRIBUTE_UNUSED,
89      char * const argv[] MODI_TEST_ATTRIBUTE_UNUSED )
90 #endif
91 {
92 	MODI_TEST_UNREFERENCED_PARAMETER( argc )
93 	MODI_TEST_UNREFERENCED_PARAMETER( argv )
94 
95 #if defined( __GNUC__ ) && !defined( LIBMODI_DLL_IMPORT )
96 
97 	/* TODO: add tests for libmodi_bands_data_handle_initialize */
98 
99 	MODI_TEST_RUN(
100 	 "libmodi_bands_data_handle_free",
101 	 modi_test_bands_data_handle_free );
102 
103 	/* TODO: add tests for libmodi_bands_data_handle_append_segment */
104 
105 	/* TODO: add tests for libmodi_bands_data_handle_read_segment_data */
106 
107 	/* TODO: add tests for libmodi_bands_data_handle_seek_segment_offset */
108 
109 #endif /* defined( __GNUC__ ) && !defined( LIBMODI_DLL_IMPORT ) */
110 
111 	return( EXIT_SUCCESS );
112 
113 on_error:
114 	return( EXIT_FAILURE );
115 }
116 
117