@@ -1346,12 +1346,21 @@ test_matching_star_ts(void)
13461346 tsk_size_t path_length ;
13471347
13481348 build_star_ts (& ts );
1349- /* Just check that matcher_indexes_alloc and find_path don't crash */
1349+ /* [0,1,0] copies node 2 */
13501350 allele_t h1 [] = { 0 , 1 , 0 };
13511351 run_match (& ts , 1e-9 , 0 , h1 , match , & path_length , left , right , parent );
1352+ CU_ASSERT_EQUAL (path_length , 1 );
1353+ CU_ASSERT_EQUAL (left [0 ], 0 );
1354+ CU_ASSERT_EQUAL (right [0 ], 100 );
1355+ CU_ASSERT_EQUAL (parent [0 ], 2 );
13521356
1357+ /* [1,0,0] copies node 3 */
13531358 allele_t h2 [] = { 1 , 0 , 0 };
13541359 run_match (& ts , 1e-9 , 0 , h2 , match , & path_length , left , right , parent );
1360+ CU_ASSERT_EQUAL (path_length , 1 );
1361+ CU_ASSERT_EQUAL (left [0 ], 0 );
1362+ CU_ASSERT_EQUAL (right [0 ], 100 );
1363+ CU_ASSERT_EQUAL (parent [0 ], 3 );
13551364
13561365 tsk_treeseq_free (& ts );
13571366}
@@ -1365,11 +1374,21 @@ test_matching_binary_ts(void)
13651374 tsk_size_t path_length ;
13661375
13671376 build_binary_ts (& ts );
1377+ /* [1,0,1,0] copies node 3 */
13681378 allele_t h1 [] = { 1 , 0 , 1 , 0 };
13691379 run_match (& ts , 1e-9 , 0 , h1 , match , & path_length , left , right , parent );
1380+ CU_ASSERT_EQUAL (path_length , 1 );
1381+ CU_ASSERT_EQUAL (left [0 ], 0 );
1382+ CU_ASSERT_EQUAL (right [0 ], 100 );
1383+ CU_ASSERT_EQUAL (parent [0 ], 3 );
13701384
1385+ /* [1,0,0,0] copies internal node 2 */
13711386 allele_t h2 [] = { 1 , 0 , 0 , 0 };
13721387 run_match (& ts , 1e-9 , 0 , h2 , match , & path_length , left , right , parent );
1388+ CU_ASSERT_EQUAL (path_length , 1 );
1389+ CU_ASSERT_EQUAL (left [0 ], 0 );
1390+ CU_ASSERT_EQUAL (right [0 ], 100 );
1391+ CU_ASSERT_EQUAL (parent [0 ], 2 );
13731392
13741393 tsk_treeseq_free (& ts );
13751394}
@@ -1383,8 +1402,13 @@ test_matching_two_tree_ts(void)
13831402 tsk_size_t path_length ;
13841403
13851404 build_two_tree_ts (& ts );
1405+ /* [1,0,0,0] copies node 2 */
13861406 allele_t h1 [] = { 1 , 0 , 0 , 0 };
13871407 run_match (& ts , 1e-9 , 0 , h1 , match , & path_length , left , right , parent );
1408+ CU_ASSERT_EQUAL (path_length , 1 );
1409+ CU_ASSERT_EQUAL (left [0 ], 0 );
1410+ CU_ASSERT_EQUAL (right [0 ], 100 );
1411+ CU_ASSERT_EQUAL (parent [0 ], 2 );
13881412
13891413 tsk_treeseq_free (& ts );
13901414}
@@ -1398,11 +1422,21 @@ test_matching_deep_chain_ts(void)
13981422 tsk_size_t path_length ;
13991423
14001424 build_deep_chain_ts (& ts );
1425+ /* [1,1,1,0] copies node 4 (C) */
14011426 allele_t h1 [] = { 1 , 1 , 1 , 0 };
14021427 run_match (& ts , 1e-9 , 0 , h1 , match , & path_length , left , right , parent );
1428+ CU_ASSERT_EQUAL (path_length , 1 );
1429+ CU_ASSERT_EQUAL (left [0 ], 0 );
1430+ CU_ASSERT_EQUAL (right [0 ], 100 );
1431+ CU_ASSERT_EQUAL (parent [0 ], 4 );
14031432
1433+ /* [1,0,0,0] copies node 2 (A) */
14041434 allele_t h2 [] = { 1 , 0 , 0 , 0 };
14051435 run_match (& ts , 1e-9 , 0 , h2 , match , & path_length , left , right , parent );
1436+ CU_ASSERT_EQUAL (path_length , 1 );
1437+ CU_ASSERT_EQUAL (left [0 ], 0 );
1438+ CU_ASSERT_EQUAL (right [0 ], 100 );
1439+ CU_ASSERT_EQUAL (parent [0 ], 2 );
14061440
14071441 tsk_treeseq_free (& ts );
14081442}
0 commit comments