Debian Codegraph @

tests/vhdi_test_file_information.c

raw symbols SCIP
1 /*
2 * Library file_information type 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 <byte_stream.h>
24 #include <file_stream.h>
25 #include <types.h>
26
27 #if defined( HAVE_STDLIB_H ) || defined( WINAPI )
28 #include <stdlib.h>
29 #endif
30
31 #include "vhdi_test_functions.h"
32 #include "vhdi_test_libbfio.h"
33 #include "vhdi_test_libcerror.h"
34 #include "vhdi_test_libvhdi.h"
35 #include "vhdi_test_macros.h"
36 #include "vhdi_test_memory.h"
37 #include "vhdi_test_unused.h"
38
39 #include "../libvhdi/libvhdi_file_information.h"
40
41 uint8_t vhdi_test_file_information_data1[ 520 ] = {
42 0x76, 0x68, 0x64, 0x78, 0x66, 0x69, 0x6c, 0x65, 0x4d, 0x00, 0x69, 0x00, 0x63, 0x00, 0x72, 0x00,
43 0x6f, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x66, 0x00, 0x74, 0x00, 0x20, 0x00, 0x57, 0x00, 0x69, 0x00,
44 0x6e, 0x00, 0x64, 0x00, 0x6f, 0x00, 0x77, 0x00, 0x73, 0x00, 0x20, 0x00, 0x31, 0x00, 0x30, 0x00,
45 0x2e, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x39, 0x00, 0x30, 0x00, 0x34, 0x00, 0x31, 0x00,
46 0x2e, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
47 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
54 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
55 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
56 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
57 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
58 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
59 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
60 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
61 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
63 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
64 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
65 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
66 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
67 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
68 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
69 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
70 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
71 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
72 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
73 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
74 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
75
76 #if defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT )
77
78 /* Tests the libvhdi_file_information_initialize function
79 * Returns 1 if successful or 0 if not
80 */
81 int vhdi_test_file_information_initialize(
82 void )
83 {
84 libcerror_error_t *error = NULL;
85 libvhdi_file_information_t *file_information = NULL;
86 int result = 0;
87
88 #if defined( HAVE_VHDI_TEST_MEMORY )
89 int number_of_malloc_fail_tests = 1;
90 int number_of_memset_fail_tests = 1;
91 int test_number = 0;
92 #endif
93
94 /* Test regular cases
95 */
96 result = libvhdi_file_information_initialize(
97 &file_information,
98 &error );
99
100 VHDI_TEST_ASSERT_EQUAL_INT(
101 "result",
102 result,
103 1 );
104
105 VHDI_TEST_ASSERT_IS_NOT_NULL(
106 "file_information",
107 file_information );
108
109 VHDI_TEST_ASSERT_IS_NULL(
110 "error",
111 error );
112
113 result = libvhdi_file_information_free(
114 &file_information,
115 &error );
116
117 VHDI_TEST_ASSERT_EQUAL_INT(
118 "result",
119 result,
120 1 );
121
122 VHDI_TEST_ASSERT_IS_NULL(
123 "file_information",
124 file_information );
125
126 VHDI_TEST_ASSERT_IS_NULL(
127 "error",
128 error );
129
130 /* Test error cases
131 */
132 result = libvhdi_file_information_initialize(
133 NULL,
134 &error );
135
136 VHDI_TEST_ASSERT_EQUAL_INT(
137 "result",
138 result,
139 -1 );
140
141 VHDI_TEST_ASSERT_IS_NOT_NULL(
142 "error",
143 error );
144
145 libcerror_error_free(
146 &error );
147
148 file_information = (libvhdi_file_information_t *) 0x12345678UL;
149
150 result = libvhdi_file_information_initialize(
151 &file_information,
152 &error );
153
154 file_information = NULL;
155
156 VHDI_TEST_ASSERT_EQUAL_INT(
157 "result",
158 result,
159 -1 );
160
161 VHDI_TEST_ASSERT_IS_NOT_NULL(
162 "error",
163 error );
164
165 libcerror_error_free(
166 &error );
167
168 #if defined( HAVE_VHDI_TEST_MEMORY )
169
170 for( test_number = 0;
171 test_number < number_of_malloc_fail_tests;
172 test_number++ )
173 {
174 /* Test libvhdi_file_information_initialize with malloc failing
175 */
176 vhdi_test_malloc_attempts_before_fail = test_number;
177
178 result = libvhdi_file_information_initialize(
179 &file_information,
180 &error );
181
182 if( vhdi_test_malloc_attempts_before_fail != -1 )
183 {
184 vhdi_test_malloc_attempts_before_fail = -1;
185
186 if( file_information != NULL )
187 {
188 libvhdi_file_information_free(
189 &file_information,
190 NULL );
191 }
192 }
193 else
194 {
195 VHDI_TEST_ASSERT_EQUAL_INT(
196 "result",
197 result,
198 -1 );
199
200 VHDI_TEST_ASSERT_IS_NULL(
201 "file_information",
202 file_information );
203
204 VHDI_TEST_ASSERT_IS_NOT_NULL(
205 "error",
206 error );
207
208 libcerror_error_free(
209 &error );
210 }
211 }
212 for( test_number = 0;
213 test_number < number_of_memset_fail_tests;
214 test_number++ )
215 {
216 /* Test libvhdi_file_information_initialize with memset failing
217 */
218 vhdi_test_memset_attempts_before_fail = test_number;
219
220 result = libvhdi_file_information_initialize(
221 &file_information,
222 &error );
223
224 if( vhdi_test_memset_attempts_before_fail != -1 )
225 {
226 vhdi_test_memset_attempts_before_fail = -1;
227
228 if( file_information != NULL )
229 {
230 libvhdi_file_information_free(
231 &file_information,
232 NULL );
233 }
234 }
235 else
236 {
237 VHDI_TEST_ASSERT_EQUAL_INT(
238 "result",
239 result,
240 -1 );
241
242 VHDI_TEST_ASSERT_IS_NULL(
243 "file_information",
244 file_information );
245
246 VHDI_TEST_ASSERT_IS_NOT_NULL(
247 "error",
248 error );
249
250 libcerror_error_free(
251 &error );
252 }
253 }
254 #endif /* defined( HAVE_VHDI_TEST_MEMORY ) */
255
256 return( 1 );
257
258 on_error:
259 if( error != NULL )
260 {
261 libcerror_error_free(
262 &error );
263 }
264 if( file_information != NULL )
265 {
266 libvhdi_file_information_free(
267 &file_information,
268 NULL );
269 }
270 return( 0 );
271 }
272
273 /* Tests the libvhdi_file_information_free function
274 * Returns 1 if successful or 0 if not
275 */
276 int vhdi_test_file_information_free(
277 void )
278 {
279 libcerror_error_t *error = NULL;
280 int result = 0;
281
282 /* Test error cases
283 */
284 result = libvhdi_file_information_free(
285 NULL,
286 &error );
287
288 VHDI_TEST_ASSERT_EQUAL_INT(
289 "result",
290 result,
291 -1 );
292
293 VHDI_TEST_ASSERT_IS_NOT_NULL(
294 "error",
295 error );
296
297 libcerror_error_free(
298 &error );
299
300 return( 1 );
301
302 on_error:
303 if( error != NULL )
304 {
305 libcerror_error_free(
306 &error );
307 }
308 return( 0 );
309 }
310
311 /* Tests the libvhdi_file_information_read_data function
312 * Returns 1 if successful or 0 if not
313 */
314 int vhdi_test_file_information_read_data(
315 void )
316 {
317 libcerror_error_t *error = NULL;
318 libvhdi_file_information_t *file_information = NULL;
319 int result = 0;
320
321 /* Initialize test
322 */
323 result = libvhdi_file_information_initialize(
324 &file_information,
325 &error );
326
327 VHDI_TEST_ASSERT_EQUAL_INT(
328 "result",
329 result,
330 1 );
331
332 VHDI_TEST_ASSERT_IS_NOT_NULL(
333 "file_information",
334 file_information );
335
336 VHDI_TEST_ASSERT_IS_NULL(
337 "error",
338 error );
339
340 /* Test regular cases
341 */
342 result = libvhdi_file_information_read_data(
343 file_information,
344 vhdi_test_file_information_data1,
345 520,
346 &error );
347
348 VHDI_TEST_ASSERT_EQUAL_INT(
349 "result",
350 result,
351 1 );
352
353 VHDI_TEST_ASSERT_IS_NULL(
354 "error",
355 error );
356
357 /* Test regular case where signature is invalid
358 */
359 byte_stream_copy_from_uint64_little_endian(
360 vhdi_test_file_information_data1,
361 0xffffffffffffffffUL );
362
363 result = libvhdi_file_information_read_data(
364 file_information,
365 vhdi_test_file_information_data1,
366 520,
367 &error );
368
369 byte_stream_copy_from_uint64_little_endian(
370 vhdi_test_file_information_data1,
371 0x656c696678646876UL );
372
373 VHDI_TEST_ASSERT_EQUAL_INT(
374 "result",
375 result,
376 0 );
377
378 VHDI_TEST_ASSERT_IS_NULL(
379 "error",
380 error );
381
382 /* Test error cases
383 */
384 result = libvhdi_file_information_read_data(
385 NULL,
386 vhdi_test_file_information_data1,
387 520,
388 &error );
389
390 VHDI_TEST_ASSERT_EQUAL_INT(
391 "result",
392 result,
393 -1 );
394
395 VHDI_TEST_ASSERT_IS_NOT_NULL(
396 "error",
397 error );
398
399 libcerror_error_free(
400 &error );
401
402 result = libvhdi_file_information_read_data(
403 file_information,
404 NULL,
405 520,
406 &error );
407
408 VHDI_TEST_ASSERT_EQUAL_INT(
409 "result",
410 result,
411 -1 );
412
413 VHDI_TEST_ASSERT_IS_NOT_NULL(
414 "error",
415 error );
416
417 libcerror_error_free(
418 &error );
419
420 result = libvhdi_file_information_read_data(
421 file_information,
422 vhdi_test_file_information_data1,
423 (size_t) SSIZE_MAX + 1,
424 &error );
425
426 VHDI_TEST_ASSERT_EQUAL_INT(
427 "result",
428 result,
429 -1 );
430
431 VHDI_TEST_ASSERT_IS_NOT_NULL(
432 "error",
433 error );
434
435 libcerror_error_free(
436 &error );
437
438 result = libvhdi_file_information_read_data(
439 file_information,
440 vhdi_test_file_information_data1,
441 0,
442 &error );
443
444 VHDI_TEST_ASSERT_EQUAL_INT(
445 "result",
446 result,
447 -1 );
448
449 VHDI_TEST_ASSERT_IS_NOT_NULL(
450 "error",
451 error );
452
453 libcerror_error_free(
454 &error );
455
456 #if defined( HAVE_VHDI_TEST_MEMORY )
457
458 /* Test libvhdi_file_information_read_data with memcpy failing
459 */
460 vhdi_test_memcpy_attempts_before_fail = 0;
461
462 result = libvhdi_file_information_read_data(
463 file_information,
464 vhdi_test_file_information_data1,
465 520,
466 &error );
467
468 if( vhdi_test_memcpy_attempts_before_fail != -1 )
469 {
470 vhdi_test_memcpy_attempts_before_fail = -1;
471 }
472 else
473 {
474 VHDI_TEST_ASSERT_EQUAL_INT(
475 "result",
476 result,
477 -1 );
478
479 VHDI_TEST_ASSERT_IS_NOT_NULL(
480 "error",
481 error );
482
483 libcerror_error_free(
484 &error );
485 }
486 #endif /* defined( HAVE_VHDI_TEST_MEMORY ) */
487
488 /* Clean up
489 */
490 result = libvhdi_file_information_free(
491 &file_information,
492 &error );
493
494 VHDI_TEST_ASSERT_EQUAL_INT(
495 "result",
496 result,
497 1 );
498
499 VHDI_TEST_ASSERT_IS_NULL(
500 "file_information",
501 file_information );
502
503 VHDI_TEST_ASSERT_IS_NULL(
504 "error",
505 error );
506
507 return( 1 );
508
509 on_error:
510 if( error != NULL )
511 {
512 libcerror_error_free(
513 &error );
514 }
515 if( file_information != NULL )
516 {
517 libvhdi_file_information_free(
518 &file_information,
519 NULL );
520 }
521 return( 0 );
522 }
523
524 /* Tests the libvhdi_file_information_read_file_io_handle function
525 * Returns 1 if successful or 0 if not
526 */
527 int vhdi_test_file_information_read_file_io_handle(
528 void )
529 {
530 libbfio_handle_t *file_io_handle = NULL;
531 libcerror_error_t *error = NULL;
532 libvhdi_file_information_t *file_information = NULL;
533 int result = 0;
534
535 /* Initialize test
536 */
537 result = libvhdi_file_information_initialize(
538 &file_information,
539 &error );
540
541 VHDI_TEST_ASSERT_EQUAL_INT(
542 "result",
543 result,
544 1 );
545
546 VHDI_TEST_ASSERT_IS_NOT_NULL(
547 "file_information",
548 file_information );
549
550 VHDI_TEST_ASSERT_IS_NULL(
551 "error",
552 error );
553
554 /* Initialize file IO handle
555 */
556 result = vhdi_test_open_file_io_handle(
557 &file_io_handle,
558 vhdi_test_file_information_data1,
559 520,
560 &error );
561
562 VHDI_TEST_ASSERT_EQUAL_INT(
563 "result",
564 result,
565 1 );
566
567 VHDI_TEST_ASSERT_IS_NOT_NULL(
568 "file_io_handle",
569 file_io_handle );
570
571 VHDI_TEST_ASSERT_IS_NULL(
572 "error",
573 error );
574
575 /* Test regular cases
576 */
577 result = libvhdi_file_information_read_file_io_handle(
578 file_information,
579 file_io_handle,
580 0,
581 &error );
582
583 VHDI_TEST_ASSERT_EQUAL_INT(
584 "result",
585 result,
586 1 );
587
588 VHDI_TEST_ASSERT_IS_NULL(
589 "error",
590 error );
591
592 /* Test regular case where signature is invalid
593 */
594 byte_stream_copy_from_uint64_little_endian(
595 vhdi_test_file_information_data1,
596 0xffffffffffffffffUL );
597
598 result = libvhdi_file_information_read_file_io_handle(
599 file_information,
600 file_io_handle,
601 0,
602 &error );
603
604 byte_stream_copy_from_uint64_little_endian(
605 vhdi_test_file_information_data1,
606 0x656c696678646876UL );
607
608 VHDI_TEST_ASSERT_EQUAL_INT(
609 "result",
610 result,
611 0 );
612
613 VHDI_TEST_ASSERT_IS_NULL(
614 "error",
615 error );
616
617 /* Test error cases
618 */
619 result = libvhdi_file_information_read_file_io_handle(
620 NULL,
621 file_io_handle,
622 0,
623 &error );
624
625 VHDI_TEST_ASSERT_EQUAL_INT(
626 "result",
627 result,
628 -1 );
629
630 VHDI_TEST_ASSERT_IS_NOT_NULL(
631 "error",
632 error );
633
634 libcerror_error_free(
635 &error );
636
637 result = libvhdi_file_information_read_file_io_handle(
638 file_information,
639 NULL,
640 0,
641 &error );
642
643 VHDI_TEST_ASSERT_EQUAL_INT(
644 "result",
645 result,
646 -1 );
647
648 VHDI_TEST_ASSERT_IS_NOT_NULL(
649 "error",
650 error );
651
652 libcerror_error_free(
653 &error );
654
655 result = libvhdi_file_information_read_file_io_handle(
656 file_information,
657 file_io_handle,
658 -1,
659 &error );
660
661 VHDI_TEST_ASSERT_EQUAL_INT(
662 "result",
663 result,
664 -1 );
665
666 VHDI_TEST_ASSERT_IS_NOT_NULL(
667 "error",
668 error );
669
670 libcerror_error_free(
671 &error );
672
673 /* Clean up file IO handle
674 */
675 result = vhdi_test_close_file_io_handle(
676 &file_io_handle,
677 &error );
678
679 VHDI_TEST_ASSERT_EQUAL_INT(
680 "result",
681 result,
682 0 );
683
684 VHDI_TEST_ASSERT_IS_NULL(
685 "error",
686 error );
687
688 /* Test data too small
689 */
690 result = vhdi_test_open_file_io_handle(
691 &file_io_handle,
692 vhdi_test_file_information_data1,
693 8,
694 &error );
695
696 VHDI_TEST_ASSERT_EQUAL_INT(
697 "result",
698 result,
699 1 );
700
701 VHDI_TEST_ASSERT_IS_NOT_NULL(
702 "file_io_handle",
703 file_io_handle );
704
705 VHDI_TEST_ASSERT_IS_NULL(
706 "error",
707 error );
708
709 result = libvhdi_file_information_read_file_io_handle(
710 file_information,
711 file_io_handle,
712 0,
713 &error );
714
715 VHDI_TEST_ASSERT_EQUAL_INT(
716 "result",
717 result,
718 -1 );
719
720 VHDI_TEST_ASSERT_IS_NOT_NULL(
721 "error",
722 error );
723
724 libcerror_error_free(
725 &error );
726
727 result = vhdi_test_close_file_io_handle(
728 &file_io_handle,
729 &error );
730
731 VHDI_TEST_ASSERT_EQUAL_INT(
732 "result",
733 result,
734 0 );
735
736 VHDI_TEST_ASSERT_IS_NULL(
737 "error",
738 error );
739
740 /* Clean up
741 */
742 result = libvhdi_file_information_free(
743 &file_information,
744 &error );
745
746 VHDI_TEST_ASSERT_EQUAL_INT(
747 "result",
748 result,
749 1 );
750
751 VHDI_TEST_ASSERT_IS_NULL(
752 "file_information",
753 file_information );
754
755 VHDI_TEST_ASSERT_IS_NULL(
756 "error",
757 error );
758
759 return( 1 );
760
761 on_error:
762 if( error != NULL )
763 {
764 libcerror_error_free(
765 &error );
766 }
767 if( file_io_handle != NULL )
768 {
769 libbfio_handle_free(
770 &file_io_handle,
771 NULL );
772 }
773 if( file_information != NULL )
774 {
775 libvhdi_file_information_free(
776 &file_information,
777 NULL );
778 }
779 return( 0 );
780 }
781
782 #endif /* defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) */
783
784 /* The main program
785 */
786 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
787 int wmain(
788 int argc VHDI_TEST_ATTRIBUTE_UNUSED,
789 wchar_t * const argv[] VHDI_TEST_ATTRIBUTE_UNUSED )
790 #else
791 int main(
792 int argc VHDI_TEST_ATTRIBUTE_UNUSED,
793 char * const argv[] VHDI_TEST_ATTRIBUTE_UNUSED )
794 #endif
795 {
796 VHDI_TEST_UNREFERENCED_PARAMETER( argc )
797 VHDI_TEST_UNREFERENCED_PARAMETER( argv )
798
799 #if defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT )
800
801 VHDI_TEST_RUN(
802 "libvhdi_file_information_initialize",
803 vhdi_test_file_information_initialize );
804
805 VHDI_TEST_RUN(
806 "libvhdi_file_information_free",
807 vhdi_test_file_information_free );
808
809 VHDI_TEST_RUN(
810 "libvhdi_file_information_read_data",
811 vhdi_test_file_information_read_data );
812
813 VHDI_TEST_RUN(
814 "libvhdi_file_information_read_file_io_handle",
815 vhdi_test_file_information_read_file_io_handle );
816
817 #endif /* defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) */
818
819 return( EXIT_SUCCESS );
820
821 #if defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT )
822
823 on_error:
824 return( EXIT_FAILURE );
825
826 #endif /* defined( __GNUC__ ) && !defined( LIBVHDI_DLL_IMPORT ) */
827 }
828