1 /*
2  * Library attribute_values type test program
3  *
4  * Copyright (C) 2010-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 "fsext_test_libcerror.h"
31 #include "fsext_test_libfsext.h"
32 #include "fsext_test_macros.h"
33 #include "fsext_test_memory.h"
34 #include "fsext_test_unused.h"
35 
36 #include "../libfsext/libfsext_attribute_values.h"
37 
38 uint8_t fsext_test_attribute_values_data1[ 24 ] = {
39         0x08, 0x01, 0xbc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x19, 0x00, 0x00, 0x00, 0x2b, 0xfe, 0x48, 0x83,
40         0x6d, 0x79, 0x78, 0x61, 0x74, 0x74, 0x72, 0x31 };
41 
42 #if defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT )
43 
44 /* Tests the libfsext_attribute_values_initialize function
45  * Returns 1 if successful or 0 if not
46  */
fsext_test_attribute_values_initialize(void)47 int fsext_test_attribute_values_initialize(
48      void )
49 {
50 	libcerror_error_t *error                      = NULL;
51 	libfsext_attribute_values_t *attribute_values = NULL;
52 	int result                                    = 0;
53 
54 #if defined( HAVE_FSEXT_TEST_MEMORY )
55 	int number_of_malloc_fail_tests               = 1;
56 	int number_of_memset_fail_tests               = 1;
57 	int test_number                               = 0;
58 #endif
59 
60 	/* Test regular cases
61 	 */
62 	result = libfsext_attribute_values_initialize(
63 	          &attribute_values,
64 	          &error );
65 
66 	FSEXT_TEST_ASSERT_EQUAL_INT(
67 	 "result",
68 	 result,
69 	 1 );
70 
71 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
72 	 "attribute_values",
73 	 attribute_values );
74 
75 	FSEXT_TEST_ASSERT_IS_NULL(
76 	 "error",
77 	 error );
78 
79 	result = libfsext_attribute_values_free(
80 	          &attribute_values,
81 	          &error );
82 
83 	FSEXT_TEST_ASSERT_EQUAL_INT(
84 	 "result",
85 	 result,
86 	 1 );
87 
88 	FSEXT_TEST_ASSERT_IS_NULL(
89 	 "attribute_values",
90 	 attribute_values );
91 
92 	FSEXT_TEST_ASSERT_IS_NULL(
93 	 "error",
94 	 error );
95 
96 	/* Test error cases
97 	 */
98 	result = libfsext_attribute_values_initialize(
99 	          NULL,
100 	          &error );
101 
102 	FSEXT_TEST_ASSERT_EQUAL_INT(
103 	 "result",
104 	 result,
105 	 -1 );
106 
107 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
108 	 "error",
109 	 error );
110 
111 	libcerror_error_free(
112 	 &error );
113 
114 	attribute_values = (libfsext_attribute_values_t *) 0x12345678UL;
115 
116 	result = libfsext_attribute_values_initialize(
117 	          &attribute_values,
118 	          &error );
119 
120 	attribute_values = NULL;
121 
122 	FSEXT_TEST_ASSERT_EQUAL_INT(
123 	 "result",
124 	 result,
125 	 -1 );
126 
127 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
128 	 "error",
129 	 error );
130 
131 	libcerror_error_free(
132 	 &error );
133 
134 #if defined( HAVE_FSEXT_TEST_MEMORY )
135 
136 	for( test_number = 0;
137 	     test_number < number_of_malloc_fail_tests;
138 	     test_number++ )
139 	{
140 		/* Test libfsext_attribute_values_initialize with malloc failing
141 		 */
142 		fsext_test_malloc_attempts_before_fail = test_number;
143 
144 		result = libfsext_attribute_values_initialize(
145 		          &attribute_values,
146 		          &error );
147 
148 		if( fsext_test_malloc_attempts_before_fail != -1 )
149 		{
150 			fsext_test_malloc_attempts_before_fail = -1;
151 
152 			if( attribute_values != NULL )
153 			{
154 				libfsext_attribute_values_free(
155 				 &attribute_values,
156 				 NULL );
157 			}
158 		}
159 		else
160 		{
161 			FSEXT_TEST_ASSERT_EQUAL_INT(
162 			 "result",
163 			 result,
164 			 -1 );
165 
166 			FSEXT_TEST_ASSERT_IS_NULL(
167 			 "attribute_values",
168 			 attribute_values );
169 
170 			FSEXT_TEST_ASSERT_IS_NOT_NULL(
171 			 "error",
172 			 error );
173 
174 			libcerror_error_free(
175 			 &error );
176 		}
177 	}
178 	for( test_number = 0;
179 	     test_number < number_of_memset_fail_tests;
180 	     test_number++ )
181 	{
182 		/* Test libfsext_attribute_values_initialize with memset failing
183 		 */
184 		fsext_test_memset_attempts_before_fail = test_number;
185 
186 		result = libfsext_attribute_values_initialize(
187 		          &attribute_values,
188 		          &error );
189 
190 		if( fsext_test_memset_attempts_before_fail != -1 )
191 		{
192 			fsext_test_memset_attempts_before_fail = -1;
193 
194 			if( attribute_values != NULL )
195 			{
196 				libfsext_attribute_values_free(
197 				 &attribute_values,
198 				 NULL );
199 			}
200 		}
201 		else
202 		{
203 			FSEXT_TEST_ASSERT_EQUAL_INT(
204 			 "result",
205 			 result,
206 			 -1 );
207 
208 			FSEXT_TEST_ASSERT_IS_NULL(
209 			 "attribute_values",
210 			 attribute_values );
211 
212 			FSEXT_TEST_ASSERT_IS_NOT_NULL(
213 			 "error",
214 			 error );
215 
216 			libcerror_error_free(
217 			 &error );
218 		}
219 	}
220 #endif /* defined( HAVE_FSEXT_TEST_MEMORY ) */
221 
222 	return( 1 );
223 
224 on_error:
225 	if( error != NULL )
226 	{
227 		libcerror_error_free(
228 		 &error );
229 	}
230 	if( attribute_values != NULL )
231 	{
232 		libfsext_attribute_values_free(
233 		 &attribute_values,
234 		 NULL );
235 	}
236 	return( 0 );
237 }
238 
239 /* Tests the libfsext_attribute_values_free function
240  * Returns 1 if successful or 0 if not
241  */
fsext_test_attribute_values_free(void)242 int fsext_test_attribute_values_free(
243      void )
244 {
245 	libcerror_error_t *error = NULL;
246 	int result               = 0;
247 
248 	/* Test error cases
249 	 */
250 	result = libfsext_attribute_values_free(
251 	          NULL,
252 	          &error );
253 
254 	FSEXT_TEST_ASSERT_EQUAL_INT(
255 	 "result",
256 	 result,
257 	 -1 );
258 
259 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
260 	 "error",
261 	 error );
262 
263 	libcerror_error_free(
264 	 &error );
265 
266 	return( 1 );
267 
268 on_error:
269 	if( error != NULL )
270 	{
271 		libcerror_error_free(
272 		 &error );
273 	}
274 	return( 0 );
275 }
276 
277 /* Tests the libfsext_attribute_values_read_data function
278  * Returns 1 if successful or 0 if not
279  */
fsext_test_attribute_values_read_data(void)280 int fsext_test_attribute_values_read_data(
281      void )
282 {
283 	libcerror_error_t *error                    = NULL;
284 	libfsext_attribute_values_t *attribute_values = NULL;
285 	int result                                  = 0;
286 
287 	/* Initialize test
288 	 */
289 	result = libfsext_attribute_values_initialize(
290 	          &attribute_values,
291 	          &error );
292 
293 	FSEXT_TEST_ASSERT_EQUAL_INT(
294 	 "result",
295 	 result,
296 	 1 );
297 
298 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
299 	 "attribute_values",
300 	 attribute_values );
301 
302 	FSEXT_TEST_ASSERT_IS_NULL(
303 	 "error",
304 	 error );
305 
306 	/* Test regular cases
307 	 */
308 	result = libfsext_attribute_values_read_data(
309 	          attribute_values,
310 	          fsext_test_attribute_values_data1,
311 	          24,
312 	          &error );
313 
314 	FSEXT_TEST_ASSERT_EQUAL_INT(
315 	 "result",
316 	 result,
317 	 1 );
318 
319 	FSEXT_TEST_ASSERT_IS_NULL(
320 	 "error",
321 	 error );
322 
323 	/* Test error cases
324 	 */
325 	result = libfsext_attribute_values_read_data(
326 	          NULL,
327 	          fsext_test_attribute_values_data1,
328 	          24,
329 	          &error );
330 
331 	FSEXT_TEST_ASSERT_EQUAL_INT(
332 	 "result",
333 	 result,
334 	 -1 );
335 
336 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
337 	 "error",
338 	 error );
339 
340 	libcerror_error_free(
341 	 &error );
342 
343 	result = libfsext_attribute_values_read_data(
344 	          attribute_values,
345 	          NULL,
346 	          24,
347 	          &error );
348 
349 	FSEXT_TEST_ASSERT_EQUAL_INT(
350 	 "result",
351 	 result,
352 	 -1 );
353 
354 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
355 	 "error",
356 	 error );
357 
358 	libcerror_error_free(
359 	 &error );
360 
361 	result = libfsext_attribute_values_read_data(
362 	          attribute_values,
363 	          fsext_test_attribute_values_data1,
364 	          (size_t) SSIZE_MAX + 1,
365 	          &error );
366 
367 	FSEXT_TEST_ASSERT_EQUAL_INT(
368 	 "result",
369 	 result,
370 	 -1 );
371 
372 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
373 	 "error",
374 	 error );
375 
376 	libcerror_error_free(
377 	 &error );
378 
379 	result = libfsext_attribute_values_read_data(
380 	          attribute_values,
381 	          fsext_test_attribute_values_data1,
382 	          0,
383 	          &error );
384 
385 	FSEXT_TEST_ASSERT_EQUAL_INT(
386 	 "result",
387 	 result,
388 	 -1 );
389 
390 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
391 	 "error",
392 	 error );
393 
394 	libcerror_error_free(
395 	 &error );
396 
397 	/* Clean up
398 	 */
399 	result = libfsext_attribute_values_free(
400 	          &attribute_values,
401 	          &error );
402 
403 	FSEXT_TEST_ASSERT_EQUAL_INT(
404 	 "result",
405 	 result,
406 	 1 );
407 
408 	FSEXT_TEST_ASSERT_IS_NULL(
409 	 "attribute_values",
410 	 attribute_values );
411 
412 	FSEXT_TEST_ASSERT_IS_NULL(
413 	 "error",
414 	 error );
415 
416 	return( 1 );
417 
418 on_error:
419 	if( error != NULL )
420 	{
421 		libcerror_error_free(
422 		 &error );
423 	}
424 	if( attribute_values != NULL )
425 	{
426 		libfsext_attribute_values_free(
427 		 &attribute_values,
428 		 NULL );
429 	}
430 	return( 0 );
431 }
432 
433 /* Tests the libfsext_attribute_values_get_utf8_name_size function
434  * Returns 1 if successful or 0 if not
435  */
fsext_test_attribute_values_get_utf8_name_size(libfsext_attribute_values_t * attribute_values)436 int fsext_test_attribute_values_get_utf8_name_size(
437      libfsext_attribute_values_t *attribute_values )
438 {
439 	libcerror_error_t *error = NULL;
440 	size_t utf8_name_size    = 0;
441 	int result               = 0;
442 
443 	/* Test regular cases
444 	 */
445 	result = libfsext_attribute_values_get_utf8_name_size(
446 	          attribute_values,
447 	          &utf8_name_size,
448 	          &error );
449 
450 	FSEXT_TEST_ASSERT_NOT_EQUAL_INT(
451 	 "result",
452 	 result,
453 	 -1 );
454 
455 	FSEXT_TEST_ASSERT_IS_NULL(
456 	 "error",
457 	 error );
458 
459 	/* Test error cases
460 	 */
461 	result = libfsext_attribute_values_get_utf8_name_size(
462 	          NULL,
463 	          &utf8_name_size,
464 	          &error );
465 
466 	FSEXT_TEST_ASSERT_EQUAL_INT(
467 	 "result",
468 	 result,
469 	 -1 );
470 
471 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
472 	 "error",
473 	 error );
474 
475 	libcerror_error_free(
476 	 &error );
477 
478 	result = libfsext_attribute_values_get_utf8_name_size(
479 		  attribute_values,
480 		  NULL,
481 		  &error );
482 
483 	FSEXT_TEST_ASSERT_EQUAL_INT(
484 	 "result",
485 	 result,
486 	 -1 );
487 
488 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
489 	 "error",
490 	 error );
491 
492 	libcerror_error_free(
493 	 &error );
494 
495 	return( 1 );
496 
497 on_error:
498 	if( error != NULL )
499 	{
500 		libcerror_error_free(
501 		 &error );
502 	}
503 	return( 0 );
504 }
505 
506 /* Tests the libfsext_attribute_values_get_utf8_name function
507  * Returns 1 if successful or 0 if not
508  */
fsext_test_attribute_values_get_utf8_name(libfsext_attribute_values_t * attribute_values)509 int fsext_test_attribute_values_get_utf8_name(
510      libfsext_attribute_values_t *attribute_values )
511 {
512 	uint8_t utf8_name[ 256 ];
513 
514 	libcerror_error_t *error = NULL;
515 	int result               = 0;
516 
517 	/* Test regular cases
518 	 */
519 	result = libfsext_attribute_values_get_utf8_name(
520 	          attribute_values,
521 	          utf8_name,
522 	          256,
523 	          &error );
524 
525 	FSEXT_TEST_ASSERT_NOT_EQUAL_INT(
526 	 "result",
527 	 result,
528 	 -1 );
529 
530 	FSEXT_TEST_ASSERT_IS_NULL(
531 	 "error",
532 	 error );
533 
534 	/* Test error cases
535 	 */
536 	result = libfsext_attribute_values_get_utf8_name(
537 	          NULL,
538 	          utf8_name,
539 	          256,
540 	          &error );
541 
542 	FSEXT_TEST_ASSERT_EQUAL_INT(
543 	 "result",
544 	 result,
545 	 -1 );
546 
547 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
548 	 "error",
549 	 error );
550 
551 	libcerror_error_free(
552 	 &error );
553 
554 	result = libfsext_attribute_values_get_utf8_name(
555 	          attribute_values,
556 	          NULL,
557 	          256,
558 	          &error );
559 
560 	FSEXT_TEST_ASSERT_EQUAL_INT(
561 	 "result",
562 	 result,
563 	 -1 );
564 
565 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
566 	 "error",
567 	 error );
568 
569 	libcerror_error_free(
570 	 &error );
571 
572 	result = libfsext_attribute_values_get_utf8_name(
573 	          attribute_values,
574 	          utf8_name,
575 	          0,
576 	          &error );
577 
578 	FSEXT_TEST_ASSERT_EQUAL_INT(
579 	 "result",
580 	 result,
581 	 -1 );
582 
583 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
584 	 "error",
585 	 error );
586 
587 	libcerror_error_free(
588 	 &error );
589 
590 	result = libfsext_attribute_values_get_utf8_name(
591 	          attribute_values,
592 	          utf8_name,
593 	          (size_t) SSIZE_MAX + 1,
594 	          &error );
595 
596 	FSEXT_TEST_ASSERT_EQUAL_INT(
597 	 "result",
598 	 result,
599 	 -1 );
600 
601 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
602 	 "error",
603 	 error );
604 
605 	libcerror_error_free(
606 	 &error );
607 
608 	return( 1 );
609 
610 on_error:
611 	if( error != NULL )
612 	{
613 		libcerror_error_free(
614 		 &error );
615 	}
616 	return( 0 );
617 }
618 
619 /* Tests the libfsext_attribute_values_get_utf16_name_size function
620  * Returns 1 if successful or 0 if not
621  */
fsext_test_attribute_values_get_utf16_name_size(libfsext_attribute_values_t * attribute_values)622 int fsext_test_attribute_values_get_utf16_name_size(
623      libfsext_attribute_values_t *attribute_values )
624 {
625 	libcerror_error_t *error = NULL;
626 	size_t utf16_name_size   = 0;
627 	int result               = 0;
628 
629 	/* Test regular cases
630 	 */
631 	result = libfsext_attribute_values_get_utf16_name_size(
632 	          attribute_values,
633 	          &utf16_name_size,
634 	          &error );
635 
636 	FSEXT_TEST_ASSERT_NOT_EQUAL_INT(
637 	 "result",
638 	 result,
639 	 -1 );
640 
641 	FSEXT_TEST_ASSERT_IS_NULL(
642 	 "error",
643 	 error );
644 
645 	/* Test error cases
646 	 */
647 	result = libfsext_attribute_values_get_utf16_name_size(
648 	          NULL,
649 	          &utf16_name_size,
650 	          &error );
651 
652 	FSEXT_TEST_ASSERT_EQUAL_INT(
653 	 "result",
654 	 result,
655 	 -1 );
656 
657 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
658 	 "error",
659 	 error );
660 
661 	libcerror_error_free(
662 	 &error );
663 
664 	result = libfsext_attribute_values_get_utf16_name_size(
665 		  attribute_values,
666 		  NULL,
667 		  &error );
668 
669 	FSEXT_TEST_ASSERT_EQUAL_INT(
670 	 "result",
671 	 result,
672 	 -1 );
673 
674 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
675 	 "error",
676 	 error );
677 
678 	libcerror_error_free(
679 	 &error );
680 
681 	return( 1 );
682 
683 on_error:
684 	if( error != NULL )
685 	{
686 		libcerror_error_free(
687 		 &error );
688 	}
689 	return( 0 );
690 }
691 
692 /* Tests the libfsext_attribute_values_get_utf16_name function
693  * Returns 1 if successful or 0 if not
694  */
fsext_test_attribute_values_get_utf16_name(libfsext_attribute_values_t * attribute_values)695 int fsext_test_attribute_values_get_utf16_name(
696      libfsext_attribute_values_t *attribute_values )
697 {
698 	uint16_t utf16_name[ 256 ];
699 
700 	libcerror_error_t *error = NULL;
701 	int result               = 0;
702 
703 	/* Test regular cases
704 	 */
705 	result = libfsext_attribute_values_get_utf16_name(
706 	          attribute_values,
707 	          utf16_name,
708 	          256,
709 	          &error );
710 
711 	FSEXT_TEST_ASSERT_NOT_EQUAL_INT(
712 	 "result",
713 	 result,
714 	 -1 );
715 
716 	FSEXT_TEST_ASSERT_IS_NULL(
717 	 "error",
718 	 error );
719 
720 	/* Test error cases
721 	 */
722 	result = libfsext_attribute_values_get_utf16_name(
723 	          NULL,
724 	          utf16_name,
725 	          256,
726 	          &error );
727 
728 	FSEXT_TEST_ASSERT_EQUAL_INT(
729 	 "result",
730 	 result,
731 	 -1 );
732 
733 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
734 	 "error",
735 	 error );
736 
737 	libcerror_error_free(
738 	 &error );
739 
740 	result = libfsext_attribute_values_get_utf16_name(
741 	          attribute_values,
742 	          NULL,
743 	          256,
744 	          &error );
745 
746 	FSEXT_TEST_ASSERT_EQUAL_INT(
747 	 "result",
748 	 result,
749 	 -1 );
750 
751 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
752 	 "error",
753 	 error );
754 
755 	libcerror_error_free(
756 	 &error );
757 
758 	result = libfsext_attribute_values_get_utf16_name(
759 	          attribute_values,
760 	          utf16_name,
761 	          0,
762 	          &error );
763 
764 	FSEXT_TEST_ASSERT_EQUAL_INT(
765 	 "result",
766 	 result,
767 	 -1 );
768 
769 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
770 	 "error",
771 	 error );
772 
773 	libcerror_error_free(
774 	 &error );
775 
776 	result = libfsext_attribute_values_get_utf16_name(
777 	          attribute_values,
778 	          utf16_name,
779 	          (size_t) SSIZE_MAX + 1,
780 	          &error );
781 
782 	FSEXT_TEST_ASSERT_EQUAL_INT(
783 	 "result",
784 	 result,
785 	 -1 );
786 
787 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
788 	 "error",
789 	 error );
790 
791 	libcerror_error_free(
792 	 &error );
793 
794 	return( 1 );
795 
796 on_error:
797 	if( error != NULL )
798 	{
799 		libcerror_error_free(
800 		 &error );
801 	}
802 	return( 0 );
803 }
804 
805 #endif /* defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT ) */
806 
807 /* The main program
808  */
809 #if defined( HAVE_WIDE_SYSTEM_CHARACTER )
wmain(int argc FSEXT_TEST_ATTRIBUTE_UNUSED,wchar_t * const argv[]FSEXT_TEST_ATTRIBUTE_UNUSED)810 int wmain(
811      int argc FSEXT_TEST_ATTRIBUTE_UNUSED,
812      wchar_t * const argv[] FSEXT_TEST_ATTRIBUTE_UNUSED )
813 #else
814 int main(
815      int argc FSEXT_TEST_ATTRIBUTE_UNUSED,
816      char * const argv[] FSEXT_TEST_ATTRIBUTE_UNUSED )
817 #endif
818 {
819 #if defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT )
820 	libcerror_error_t *error                      = NULL;
821 	libfsext_attribute_values_t *attribute_values = NULL;
822 	int result                                    = 0;
823 #endif
824 
825 	FSEXT_TEST_UNREFERENCED_PARAMETER( argc )
826 	FSEXT_TEST_UNREFERENCED_PARAMETER( argv )
827 
828 #if defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT )
829 
830 	FSEXT_TEST_RUN(
831 	 "libfsext_attribute_values_initialize",
832 	 fsext_test_attribute_values_initialize );
833 
834 	FSEXT_TEST_RUN(
835 	 "libfsext_attribute_values_free",
836 	 fsext_test_attribute_values_free );
837 
838 	FSEXT_TEST_RUN(
839 	 "libfsext_attribute_values_read_data",
840 	 fsext_test_attribute_values_read_data );
841 
842 #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 )
843 
844 	/* Initialize attribute_values for tests
845 	 */
846 	result = libfsext_attribute_values_initialize(
847 	          &attribute_values,
848 	          &error );
849 
850 	FSEXT_TEST_ASSERT_EQUAL_INT(
851 	 "result",
852 	 result,
853 	 1 );
854 
855 	FSEXT_TEST_ASSERT_IS_NOT_NULL(
856 	 "attribute_values",
857 	 attribute_values );
858 
859 	FSEXT_TEST_ASSERT_IS_NULL(
860 	 "error",
861 	 error );
862 
863 	result = libfsext_attribute_values_read_data(
864 	          attribute_values,
865 	          fsext_test_attribute_values_data1,
866 	          24,
867 	          &error );
868 
869 	FSEXT_TEST_ASSERT_EQUAL_INT(
870 	 "result",
871 	 result,
872 	 1 );
873 
874 	FSEXT_TEST_ASSERT_IS_NULL(
875 	 "error",
876 	 error );
877 
878 	/* Run tests
879 	 */
880 	FSEXT_TEST_RUN_WITH_ARGS(
881 	 "libfsext_attribute_values_get_utf8_name_size",
882 	 fsext_test_attribute_values_get_utf8_name_size,
883 	 attribute_values );
884 
885 	FSEXT_TEST_RUN_WITH_ARGS(
886 	 "libfsext_attribute_values_get_utf8_name",
887 	 fsext_test_attribute_values_get_utf8_name,
888 	 attribute_values );
889 
890 	FSEXT_TEST_RUN_WITH_ARGS(
891 	 "libfsext_attribute_values_get_utf16_name_size",
892 	 fsext_test_attribute_values_get_utf16_name_size,
893 	 attribute_values );
894 
895 	FSEXT_TEST_RUN_WITH_ARGS(
896 	 "libfsext_attribute_values_get_utf16_name",
897 	 fsext_test_attribute_values_get_utf16_name,
898 	 attribute_values );
899 
900 	/* Clean up
901 	 */
902 	result = libfsext_attribute_values_free(
903 	          &attribute_values,
904 	          &error );
905 
906 	FSEXT_TEST_ASSERT_EQUAL_INT(
907 	 "result",
908 	 result,
909 	 1 );
910 
911 	FSEXT_TEST_ASSERT_IS_NULL(
912 	 "attribute_values",
913 	 attribute_values );
914 
915 	FSEXT_TEST_ASSERT_IS_NULL(
916 	 "error",
917 	 error );
918 
919 #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */
920 
921 #endif /* defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT ) */
922 
923 	return( EXIT_SUCCESS );
924 
925 #if defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT )
926 
927 on_error:
928 #if !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 )
929 
930 	if( error != NULL )
931 	{
932 		libcerror_error_free(
933 		 &error );
934 	}
935 	if( attribute_values != NULL )
936 	{
937 		libfsext_attribute_values_free(
938 		 &attribute_values,
939 		 NULL );
940 	}
941 #endif /* !defined( __BORLANDC__ ) || ( __BORLANDC__ >= 0x0560 ) */
942 
943 	return( EXIT_FAILURE );
944 
945 #endif /* defined( __GNUC__ ) && !defined( LIBFSEXT_DLL_IMPORT ) */
946 }
947 
948