91 #include "../src/xrif.h"
107 ck_assert_int_eq( hand.
width, 0);
108 ck_assert_int_eq( hand.
height, 0);
109 ck_assert_int_eq( hand.
depth, 0);
110 ck_assert_int_eq( hand.
frames, 0);
121 ck_assert_int_eq( hand.
own_raw, 0);
159 ck_assert( hand != NULL);
160 ck_assert_int_eq( hand->
width, 0);
161 ck_assert_int_eq( hand->
height, 0);
162 ck_assert_int_eq( hand->
depth, 0);
163 ck_assert_int_eq( hand->
frames, 0);
174 ck_assert_int_eq( hand->
own_raw, 0);
205 ck_assert_int_eq( hand.
width, 1024);
206 ck_assert_int_eq( hand.
height, 64);
207 ck_assert_int_eq( hand.
depth, 32);
208 ck_assert_int_eq( hand.
frames, 1000);
210 ck_assert_int_eq( hand.
data_size,
sizeof(int16_t));
221 ck_assert_int_eq( hand.
own_raw, 0);
264 rv =
xrif_set_raw( &hand, &buff, 120*120*3*120*
sizeof(int16_t));
266 ck_assert( hand.
own_raw == 0 );
267 ck_assert( hand.
raw_buffer == (
char *) &buff );
275 rv =
xrif_set_raw( &hand, &buff, LZ4_compressBound( 120*120*3*120*
sizeof(int16_t) ));
277 ck_assert( hand.
own_raw == 0 );
278 ck_assert( hand.
raw_buffer == (
char *) &buff );
279 ck_assert( hand.
raw_buffer_size = LZ4_compressBound( 120*120*3*120*
sizeof(int16_t) ) );
304 int16_t * buff = (uint16_t *) 10;
320 rv =
xrif_set_raw( &hand, buff, 0.5*120*120*3*120*
sizeof(int16_t));
322 ck_assert( hand.
own_raw == 0 );
323 ck_assert( hand.
raw_buffer == (
char *) buff );
331 rv =
xrif_set_raw( &hand, buff, 0.5*120*120*3*120*
sizeof(int16_t) );
333 ck_assert( hand.
own_raw == 0 );
334 ck_assert( hand.
raw_buffer == (
char *) buff );
388 int16_t * buff = (uint16_t *) 10;
417 size_t lz4sz = LZ4_compressBound(120*120*3*120*
sizeof(int16_t));
448 int16_t * buff = (uint16_t *) 10;
461 buff = (uint16_t *) 10;
506 char header[XRIF_HEADER_SIZE];
512 ck_assert( header[0] ==
'x' );
513 ck_assert( header[1] ==
'r' );
514 ck_assert( header[2] ==
'i' );
515 ck_assert( header[3] ==
'f' );
517 ck_assert( *((uint32_t *) &header[4]) == XRIF_VERSION);
518 ck_assert( *((uint32_t *) &header[8]) == XRIF_HEADER_SIZE);
519 ck_assert( *((uint32_t *) &header[12]) == hand.
width);
520 ck_assert( *((uint32_t *) &header[16]) == hand.
height);
521 ck_assert( *((uint32_t *) &header[20]) == hand.
depth);
522 ck_assert( *((uint32_t *) &header[24]) == hand.
frames);
523 ck_assert( *((uint16_t *) &header[28]) == hand.
type_code);
529 ck_assert( *((uint16_t *) &header[42]) == 0);
530 ck_assert( *((uint16_t *) &header[44]) == 0);
531 ck_assert( *((uint16_t *) &header[46]) == 0);
553 char header[XRIF_HEADER_SIZE];
566 uint32_t header_size;
571 ck_assert_int_eq( header_size, XRIF_HEADER_SIZE);
572 ck_assert_int_eq( hand2.
width, 120);
573 ck_assert_int_eq( hand2.
height, 240);
574 ck_assert_int_eq( hand2.
depth, 2);
575 ck_assert_int_eq( hand2.
frames, 1000);
577 ck_assert_int_eq( hand2.
data_size,
sizeof(int16_t));
588 ck_assert_int_eq( hand2.
own_raw, 0);
602 Suite * initandalloc_suite(
void)
607 s = suite_create(
"Initialize and Allocate");
610 tc_core = tcase_create(
"Initial Setups");
612 tcase_add_test(tc_core, initialize_handle_noerror);
613 tcase_add_test(tc_core, initialize_handle_nullptr);
614 tcase_add_test(tc_core, new_delete_noerror);
615 tcase_add_test(tc_core, setup_noerror );
616 tcase_add_test(tc_core, setup_nullptr );
617 tcase_add_test(tc_core, allocate_raw_noerrors);
618 tcase_add_test(tc_core, set_raw_noerrors);
619 tcase_add_test(tc_core, set_raw_noerrors);
620 tcase_add_test(tc_core, set_reordered_noerrors);
621 tcase_add_test(tc_core, set_reordered_errors);
622 tcase_add_test(tc_core, set_compressed_noerrors);
623 tcase_add_test(tc_core, set_compressed_errors);
624 suite_add_tcase(s, tc_core);
629 Suite * headerformat_suite(
void)
634 s = suite_create(
"Header Formatting");
637 tc_core = tcase_create(
"Write and Read No Errors");
639 tcase_add_test(tc_core, header_write );
640 tcase_add_test(tc_core, header_read );
641 suite_add_tcase(s, tc_core);
655 s = initandalloc_suite();
656 sr = srunner_create(s);
658 srunner_run_all(sr, CK_NORMAL);
659 number_failed = srunner_ntests_failed(sr);
662 s = headerformat_suite();
663 sr = srunner_create(s);
665 srunner_run_all(sr, CK_NORMAL);
666 number_failed = srunner_ntests_failed(sr);
669 return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;