@@ -50,34 +50,36 @@ validate_encoder(
50
50
/* vcz_variant_encoder_print_state(encoder, stdout); */
51
51
52
52
for (j = 0 ; j < num_rows ; j ++ ) {
53
- /* We need space for the NULL byte as well */
54
- min_len = (int64_t ) strlen (expected [j ]) + 1 ;
55
53
/* printf("expected: %s\n", expected[j]); */
56
54
55
+ /* We need space for the NULL byte as well */
56
+ min_len = (int64_t ) strlen (expected [j ]) + 1 ;
57
57
for (buflen = 0 ; buflen < min_len ; buflen ++ ) {
58
58
buf = malloc ((size_t ) buflen );
59
59
CU_ASSERT_FATAL (buf != NULL );
60
60
ret = vcz_variant_encoder_encode (encoder , j , buf , (size_t ) buflen );
61
61
free (buf );
62
62
CU_ASSERT_FATAL (ret == VCZ_ERR_BUFFER_OVERFLOW );
63
63
}
64
+
64
65
buflen = min_len ;
65
66
buf = malloc ((size_t ) buflen );
66
67
CU_ASSERT_FATAL (buf != NULL );
67
68
ret = vcz_variant_encoder_encode (encoder , j , buf , (size_t ) buflen );
68
- /* printf("ret = %d\n", (int) ret); */
69
- /* printf("GOT:'%s'\n", buf); */
70
- /* printf("EXP:'%s'\n", expected[j]); */
71
- /* printf("GOT:%d\n", (int) strlen(buf)); */
72
- /* printf("EXP:%d\n", (int) strlen(expected[j])); */
73
- /* int64_t c; */
74
- /* for (c = 0; c < ret; c++) { */
75
- /* if (buf[c] != expected[j][c]) { */
76
- /* printf("Mismatch at %d: %c != %c\n", (int) c, buf[c], expected[j][c]);
77
- */
78
-
79
- /* } */
80
- /* } */
69
+ /*
70
+ printf("ret = %d\n", (int) ret);
71
+ printf("GOT:'%s'\n", buf);
72
+ printf("EXP:'%s'\n", expected[j]);
73
+ printf("GOT:%d\n", (int) strlen(buf));
74
+ printf("EXP:%d\n", (int) strlen(expected[j]));
75
+ int64_t c;
76
+ for (c = 0; c < ret; c++) {
77
+ if (buf[c] != expected[j][c]) {
78
+ printf("Mismatch at %d: %c != %c\n", (int) c, buf[c], expected[j][c]);
79
+
80
+ }
81
+ }
82
+ */
81
83
CU_ASSERT_EQUAL_FATAL (ret , strlen (expected [j ]));
82
84
CU_ASSERT_NSTRING_EQUAL_FATAL (buf , expected [j ], ret );
83
85
free (buf );
@@ -370,7 +372,7 @@ test_variant_encoder_minimal(void)
370
372
const char alt_data [] = "T" ;
371
373
const float qual_data [] = { 9 , 12.1f };
372
374
const char filter_id_data [] = "PASS\0FILT1" ;
373
- const int8_t filter_data [] = { 1 , 0 , 0 , 1 };
375
+ const int8_t filter_data [] = { 1 , 1 , 0 , 1 };
374
376
const int32_t an_data [] = { -1 , 9 };
375
377
const char * aa_data = "G." ;
376
378
const int8_t flag_data [] = { 0 , 1 };
@@ -381,7 +383,7 @@ test_variant_encoder_minimal(void)
381
383
int64_t ret ;
382
384
vcz_variant_encoder_t writer ;
383
385
const char * expected [] = {
384
- "X\t123\tRS1\tA\tT\t9\tPASS\tAA=G\tGT:HQ:GL\t0/0:10,15:1,2\t0|1:7,12:3,4" ,
386
+ "X\t123\tRS1\tA\tT\t9\tPASS;FILT1 \tAA=G\tGT:HQ:GL\t0/0:10,15:1,2\t0|1:7,12:3,4" ,
385
387
"YY\t45678\tRS2\tG\t.\t12.1\tFILT1\tAN=9;FLAG\tGT:GL\t1|1:1.1,1.2\t1/0:1.3,1.4" ,
386
388
};
387
389
0 commit comments