1 /*
2 * Library record type 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 "evtx_test_libcerror.h"
31 #include "evtx_test_libevtx.h"
32 #include "evtx_test_macros.h"
33 #include "evtx_test_memory.h"
34 #include "evtx_test_unused.h"
35
36 #include "../libevtx/libevtx_record.h"
37
38 /* Tests the libevtx_record_free function
39 * Returns 1 if successful or 0 if not
40 */
evtx_test_record_free(void)41 int evtx_test_record_free(
42 void )
43 {
44 libcerror_error_t *error = NULL;
45 int result = 0;
46
47 /* Test error cases
48 */
49 result = libevtx_record_free(
50 NULL,
51 &error );
52
53 EVTX_TEST_ASSERT_EQUAL_INT(
54 "result",
55 result,
56 -1 );
57
58 EVTX_TEST_ASSERT_IS_NOT_NULL(
59 "error",
60 error );
61
62 libcerror_error_free(
63 &error );
64
65 return( 1 );
66
67 on_error:
68 if( error != NULL )
69 {
70 libcerror_error_free(
71 &error );
72 }
73 return( 0 );
74 }
75
76 /* The main program
77 */
78 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
wmain(int argc EVTX_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]EVTX_TEST_ATTRIBUTE_UNUSED)79 int wmain(
80 int argc EVTX_TEST_ATTRIBUTE_UNUSED,
81 wchar_t * const argv[] EVTX_TEST_ATTRIBUTE_UNUSED )
82 #else
83 int main(
84 int argc EVTX_TEST_ATTRIBUTE_UNUSED,
85 char * const argv[] EVTX_TEST_ATTRIBUTE_UNUSED )
86 #endif
87 {
88 EVTX_TEST_UNREFERENCED_PARAMETER( argc )
89 EVTX_TEST_UNREFERENCED_PARAMETER( argv )
90
91 #if defined( __GNUC__ ) && !defined( LIBEVTX_DLL_IMPORT )
92
93 /* TODO: add tests for libevtx_record_initialize */
94
95 #endif /* defined( __GNUC__ ) && !defined( LIBEVTX_DLL_IMPORT ) */
96
97 EVTX_TEST_RUN(
98 "libevtx_record_free",
99 evtx_test_record_free );
100
101 #if defined( __GNUC__ ) && !defined( LIBEVTX_DLL_IMPORT )
102
103 /* TODO: add tests for libevtx_record_get_offset */
104
105 /* TODO: add tests for libevtx_record_get_identifier */
106
107 /* TODO: add tests for libevtx_record_get_written_time */
108
109 /* TODO: add tests for libevtx_record_get_event_identifier */
110
111 /* TODO: add tests for libevtx_record_get_event_identifier_qualifiers */
112
113 /* TODO: add tests for libevtx_record_get_event_level */
114
115 /* TODO: add tests for libevtx_record_get_utf8_provider_identifier_size */
116
117 /* TODO: add tests for libevtx_record_get_utf8_provider_identifier */
118
119 /* TODO: add tests for libevtx_record_get_utf16_provider_identifier_size */
120
121 /* TODO: add tests for libevtx_record_get_utf16_provider_identifier */
122
123 /* TODO: add tests for libevtx_record_get_utf8_source_name_size */
124
125 /* TODO: add tests for libevtx_record_get_utf8_source_name */
126
127 /* TODO: add tests for libevtx_record_get_utf16_source_name_size */
128
129 /* TODO: add tests for libevtx_record_get_utf16_source_name */
130
131 /* TODO: add tests for libevtx_record_get_utf8_computer_name_size */
132
133 /* TODO: add tests for libevtx_record_get_utf8_computer_name */
134
135 /* TODO: add tests for libevtx_record_get_utf16_computer_name_size */
136
137 /* TODO: add tests for libevtx_record_get_utf16_computer_name */
138
139 /* TODO: add tests for libevtx_record_get_utf8_user_security_identifier_size */
140
141 /* TODO: add tests for libevtx_record_get_utf8_user_security_identifier */
142
143 /* TODO: add tests for libevtx_record_get_utf16_user_security_identifier_size */
144
145 /* TODO: add tests for libevtx_record_get_utf16_user_security_identifier */
146
147 /* TODO: add tests for libevtx_record_parse_data_with_template_definition */
148
149 /* TODO: add tests for libevtx_record_get_number_of_strings */
150
151 /* TODO: add tests for libevtx_record_get_utf8_string_size */
152
153 /* TODO: add tests for libevtx_record_get_utf8_string */
154
155 /* TODO: add tests for libevtx_record_get_utf16_string_size */
156
157 /* TODO: add tests for libevtx_record_get_utf16_string */
158
159 /* TODO: add tests for libevtx_record_get_data_size */
160
161 /* TODO: add tests for libevtx_record_get_data */
162
163 /* TODO: add tests for libevtx_record_get_utf8_xml_string_size */
164
165 /* TODO: add tests for libevtx_record_get_utf8_xml_string */
166
167 /* TODO: add tests for libevtx_record_get_utf16_xml_string_size */
168
169 /* TODO: add tests for libevtx_record_get_utf16_xml_string */
170
171 #endif /* defined( __GNUC__ ) && !defined( LIBEVTX_DLL_IMPORT ) */
172
173 return( EXIT_SUCCESS );
174
175 on_error:
176 return( EXIT_FAILURE );
177 }
178
179