Skip to content

Commit

Permalink
Restore rec length tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Jun 17, 2024
1 parent 98aa8fc commit 8ca358f
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions tests/check_branch_sequences.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,61 +95,61 @@ int test_bases_in_recombinations(int block_size)
return calculate_number_of_bases_in_recombinations(block_coords, block_size, child_sequence, snp_locations,12,0);
}

//int test_bases_in_recombinations_with_gaps(int block_size)
//{
// int ** block_coords;
// block_coords = (int **) malloc(2*sizeof(int*));
// block_coords[0] = (int*) malloc((4)*sizeof(int ));
// block_coords[1] = (int*) malloc((4)*sizeof(int ));
// block_coords[0][0] = 5;
// block_coords[1][0] = 10;
// block_coords[0][1] = 100;
// block_coords[1][1] = 110;
// block_coords[0][2] = 15;
// block_coords[1][2] = 20;
// block_coords[0][3] = 7;
// block_coords[1][3] = 15;
// char * child_sequence = "--A---AAAAAAAAAAAAAT";
// int snp_locations[16] = {1,4,5,6,7,8,9,10,11,15,20,30,40,50,100,110};
// return calculate_number_of_bases_in_recombinations(block_coords, block_size, child_sequence, snp_locations,16,0);
//}
//
//int test_bases_in_recombinations_including_gaps(int block_size)
//{
// int ** block_coords;
// block_coords = (int **) malloc(2*sizeof(int*));
// block_coords[0] = (int*) malloc((4)*sizeof(int ));
// block_coords[1] = (int*) malloc((4)*sizeof(int ));
// block_coords[0][0] = 5;
// block_coords[1][0] = 10;
// block_coords[0][1] = 100;
// block_coords[1][1] = 110;
// block_coords[0][2] = 15;
// block_coords[1][2] = 20;
// block_coords[0][3] = 7;
// block_coords[1][3] = 15;
// char * child_sequence = "--A---AAAAAAAAAAAAAT";
// int snp_locations[16] = {1,4,5,6,7,8,9,10,11,15,20,30,40,50,100,110};
// return calculate_number_of_bases_in_recombinations(block_coords, block_size, child_sequence, snp_locations,16,1);
//}
//
//START_TEST (check_calculate_number_of_bases_in_recombations)
//{
// ck_assert(test_bases_in_recombinations(4) == 27);
// ck_assert(test_bases_in_recombinations(3) == 23);
// ck_assert(test_bases_in_recombinations(2) == 17);
// ck_assert(test_bases_in_recombinations(1) == 6);
//
// ck_assert(test_bases_in_recombinations_with_gaps(4) == 24);
// ck_assert(test_bases_in_recombinations_with_gaps(3) == 20);
// ck_assert(test_bases_in_recombinations_with_gaps(2) == 14);
// ck_assert(test_bases_in_recombinations_with_gaps(1) == 3);
//
// ck_assert(test_bases_in_recombinations_with_gaps(4) < test_bases_in_recombinations_including_gaps(4));
// ck_assert(test_bases_in_recombinations(4) == test_bases_in_recombinations_including_gaps(4));
//
//}
//END_TEST
int test_bases_in_recombinations_with_gaps(int block_size)
{
int ** block_coords;
block_coords = (int **) malloc(2*sizeof(int*));
block_coords[0] = (int*) malloc((4)*sizeof(int ));
block_coords[1] = (int*) malloc((4)*sizeof(int ));
block_coords[0][0] = 5;
block_coords[1][0] = 10;
block_coords[0][1] = 100;
block_coords[1][1] = 110;
block_coords[0][2] = 15;
block_coords[1][2] = 20;
block_coords[0][3] = 7;
block_coords[1][3] = 15;
char * child_sequence = "--A---AAAAAAAAAAAAAT";
int snp_locations[16] = {1,4,5,6,7,8,9,10,11,15,20,30,40,50,100,110};
return calculate_number_of_bases_in_recombinations(block_coords, block_size, child_sequence, snp_locations,16,0);
}

int test_bases_in_recombinations_including_gaps(int block_size)
{
int ** block_coords;
block_coords = (int **) malloc(2*sizeof(int*));
block_coords[0] = (int*) malloc((4)*sizeof(int ));
block_coords[1] = (int*) malloc((4)*sizeof(int ));
block_coords[0][0] = 5;
block_coords[1][0] = 10;
block_coords[0][1] = 100;
block_coords[1][1] = 110;
block_coords[0][2] = 15;
block_coords[1][2] = 20;
block_coords[0][3] = 7;
block_coords[1][3] = 15;
char * child_sequence = "--A---AAAAAAAAAAAAAT";
int snp_locations[16] = {1,4,5,6,7,8,9,10,11,15,20,30,40,50,100,110};
return calculate_number_of_bases_in_recombinations(block_coords, block_size, child_sequence, snp_locations,16,1);
}

START_TEST (check_calculate_number_of_bases_in_recombations)
{
ck_assert(test_bases_in_recombinations(4) == 27);
ck_assert(test_bases_in_recombinations(3) == 23);
ck_assert(test_bases_in_recombinations(2) == 17);
ck_assert(test_bases_in_recombinations(1) == 6);

ck_assert(test_bases_in_recombinations_with_gaps(4) == 24);
ck_assert(test_bases_in_recombinations_with_gaps(3) == 20);
ck_assert(test_bases_in_recombinations_with_gaps(2) == 14);
ck_assert(test_bases_in_recombinations_with_gaps(1) == 3);

ck_assert(test_bases_in_recombinations_with_gaps(4) < test_bases_in_recombinations_including_gaps(4));
ck_assert(test_bases_in_recombinations(4) == test_bases_in_recombinations_including_gaps(4));

}
END_TEST

START_TEST (check_get_list_of_snp_indices_which_fall_in_downstream_recombinations_single_block)
{
Expand Down Expand Up @@ -282,7 +282,7 @@ Suite * check_branch_sequences_suite (void)
TCase *tc_branch_sequences = tcase_create ("excluding_recombinations");
tcase_add_test (tc_branch_sequences, check_exclude_snp_sites_in_block);
tcase_add_test (tc_branch_sequences, check_copy_and_concat_2d_integer_arrays);
// tcase_add_test (tc_branch_sequences, check_calculate_number_of_bases_in_recombations);
tcase_add_test (tc_branch_sequences, check_calculate_number_of_bases_in_recombations);
tcase_add_test (tc_branch_sequences, check_get_list_of_snp_indices_which_fall_in_downstream_recombinations);
tcase_add_test (tc_branch_sequences, check_get_list_of_snp_indices_which_fall_in_downstream_recombinations_single_block);
tcase_add_test (tc_branch_sequences, check_calculate_genome_length_clonal_frame_single_recomb);
Expand Down

0 comments on commit 8ca358f

Please sign in to comment.