@@ -534,100 +534,6 @@ verify_tree_next_prev(tsk_treeseq_t *ts)
534
534
free (trees );
535
535
}
536
536
537
- static void
538
- verify_tree_diffs (tsk_treeseq_t * ts , tsk_flags_t options )
539
- {
540
- int ret , valid_tree ;
541
- tsk_diff_iter_t iter ;
542
- tsk_tree_t tree ;
543
- tsk_edge_list_node_t * record ;
544
- tsk_edge_list_t records_out , records_in ;
545
- tsk_size_t num_nodes = tsk_treeseq_get_num_nodes (ts );
546
- tsk_size_t j , num_trees ;
547
- double lft , rgt ;
548
- tsk_id_t * parent = tsk_malloc (num_nodes * sizeof (tsk_id_t ));
549
- tsk_id_t * child = tsk_malloc (num_nodes * sizeof (tsk_id_t ));
550
- tsk_id_t * sib = tsk_malloc (num_nodes * sizeof (tsk_id_t ));
551
-
552
- CU_ASSERT_FATAL (parent != NULL );
553
- CU_ASSERT_FATAL (child != NULL );
554
- CU_ASSERT_FATAL (sib != NULL );
555
- for (j = 0 ; j < num_nodes ; j ++ ) {
556
- parent [j ] = TSK_NULL ;
557
- child [j ] = TSK_NULL ;
558
- sib [j ] = TSK_NULL ;
559
- }
560
- ret = tsk_diff_iter_init_from_ts (& iter , ts , options );
561
- CU_ASSERT_EQUAL_FATAL (ret , 0 );
562
- ret = tsk_tree_init (& tree , ts , 0 );
563
- CU_ASSERT_EQUAL_FATAL (ret , 0 );
564
- valid_tree = tsk_tree_first (& tree );
565
- CU_ASSERT_EQUAL_FATAL (valid_tree , TSK_TREE_OK );
566
- tsk_diff_iter_print_state (& iter , _devnull );
567
-
568
- num_trees = 0 ;
569
- while ((ret = tsk_diff_iter_next (& iter , & lft , & rgt , & records_out , & records_in ))
570
- == TSK_TREE_OK ) {
571
- tsk_diff_iter_print_state (& iter , _devnull );
572
- num_trees ++ ;
573
- /* Update forwards */
574
- for (record = records_out .head ; record != NULL ; record = record -> next ) {
575
- parent [record -> edge .child ] = TSK_NULL ;
576
- }
577
- for (record = records_in .head ; record != NULL ; record = record -> next ) {
578
- parent [record -> edge .child ] = record -> edge .parent ;
579
- }
580
- if (valid_tree ) {
581
- /* Now check against the sparse tree iterator. */
582
- for (j = 0 ; j < num_nodes ; j ++ ) {
583
- CU_ASSERT_EQUAL (parent [j ], tree .parent [j ]);
584
- }
585
- }
586
- /* Update backwards */
587
- for (record = records_out .tail ; record != NULL ; record = record -> prev ) {
588
- parent [record -> edge .child ] = TSK_NULL ;
589
- }
590
- for (record = records_in .tail ; record != NULL ; record = record -> prev ) {
591
- parent [record -> edge .child ] = record -> edge .parent ;
592
- }
593
- if (valid_tree ) {
594
- /* Now check against the sparse tree iterator. */
595
- for (j = 0 ; j < num_nodes ; j ++ ) {
596
- CU_ASSERT_EQUAL (parent [j ], tree .parent [j ]);
597
- }
598
- CU_ASSERT_EQUAL (tree .interval .left , lft );
599
- CU_ASSERT_EQUAL (tree .interval .right , rgt );
600
- valid_tree = tsk_tree_next (& tree );
601
- if (num_trees < tsk_treeseq_get_num_trees (ts )) {
602
- CU_ASSERT_EQUAL (ret , TSK_TREE_OK );
603
- } else {
604
- CU_ASSERT_EQUAL (valid_tree , 0 );
605
- }
606
- } else {
607
- CU_ASSERT_TRUE_FATAL (options & TSK_INCLUDE_TERMINAL );
608
- for (j = 0 ; j < num_nodes ; j ++ ) {
609
- CU_ASSERT_EQUAL (parent [j ], -1 );
610
- }
611
- CU_ASSERT_EQUAL (lft , tsk_treeseq_get_sequence_length (ts ));
612
- CU_ASSERT_EQUAL (rgt , tsk_treeseq_get_sequence_length (ts ));
613
- }
614
- }
615
- if (options & TSK_INCLUDE_TERMINAL ) {
616
- CU_ASSERT_EQUAL (num_trees , tsk_treeseq_get_num_trees (ts ) + 1 );
617
- } else {
618
- CU_ASSERT_EQUAL (num_trees , tsk_treeseq_get_num_trees (ts ));
619
- }
620
- CU_ASSERT_EQUAL_FATAL (valid_tree , 0 );
621
- ret = tsk_diff_iter_free (& iter );
622
- CU_ASSERT_EQUAL_FATAL (ret , 0 );
623
- ret = tsk_tree_free (& tree );
624
- CU_ASSERT_EQUAL_FATAL (ret , 0 );
625
-
626
- free (parent );
627
- free (child );
628
- free (sib );
629
- }
630
-
631
537
static void
632
538
verify_edge_array_single_tree (
633
539
tsk_tree_t * tree , tsk_edge_table_t * edge_table , tsk_size_t num_nodes )
@@ -5918,71 +5824,6 @@ test_convenience_arrays_multi_tree(void)
5918
5824
tsk_treeseq_free (& ts );
5919
5825
}
5920
5826
5921
- /*=======================================================
5922
- * Diff iter tests.
5923
- *======================================================*/
5924
-
5925
- static void
5926
- test_simple_diff_iter (void )
5927
- {
5928
- int ret ;
5929
- tsk_treeseq_t ts ;
5930
-
5931
- tsk_treeseq_from_text (& ts , 10 , paper_ex_nodes , paper_ex_edges , NULL , NULL , NULL ,
5932
- paper_ex_individuals , NULL , 0 );
5933
-
5934
- verify_tree_diffs (& ts , 0 );
5935
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
5936
-
5937
- ret = tsk_treeseq_free (& ts );
5938
- CU_ASSERT_EQUAL (ret , 0 );
5939
- }
5940
-
5941
- static void
5942
- test_nonbinary_diff_iter (void )
5943
- {
5944
- int ret ;
5945
- tsk_treeseq_t ts ;
5946
-
5947
- tsk_treeseq_from_text (& ts , 100 , nonbinary_ex_nodes , nonbinary_ex_edges , NULL , NULL ,
5948
- NULL , NULL , NULL , 0 );
5949
- verify_tree_diffs (& ts , 0 );
5950
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
5951
-
5952
- ret = tsk_treeseq_free (& ts );
5953
- CU_ASSERT_EQUAL (ret , 0 );
5954
- }
5955
-
5956
- static void
5957
- test_unary_diff_iter (void )
5958
- {
5959
- int ret ;
5960
- tsk_treeseq_t ts ;
5961
-
5962
- tsk_treeseq_from_text (
5963
- & ts , 10 , unary_ex_nodes , unary_ex_edges , NULL , NULL , NULL , NULL , NULL , 0 );
5964
- verify_tree_diffs (& ts , 0 );
5965
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
5966
-
5967
- ret = tsk_treeseq_free (& ts );
5968
- CU_ASSERT_EQUAL (ret , 0 );
5969
- }
5970
-
5971
- static void
5972
- test_internal_sample_diff_iter (void )
5973
- {
5974
- int ret ;
5975
- tsk_treeseq_t ts ;
5976
-
5977
- tsk_treeseq_from_text (& ts , 10 , internal_sample_ex_nodes , internal_sample_ex_edges ,
5978
- NULL , NULL , NULL , NULL , NULL , 0 );
5979
- verify_tree_diffs (& ts , 0 );
5980
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
5981
-
5982
- ret = tsk_treeseq_free (& ts );
5983
- CU_ASSERT_EQUAL (ret , 0 );
5984
- }
5985
-
5986
5827
static void
5987
5828
test_multiroot_mrca (void )
5988
5829
{
@@ -6012,36 +5853,6 @@ test_multiroot_mrca(void)
6012
5853
tsk_treeseq_free (& ts );
6013
5854
}
6014
5855
6015
- static void
6016
- test_multiroot_diff_iter (void )
6017
- {
6018
- int ret ;
6019
- tsk_treeseq_t ts ;
6020
-
6021
- tsk_treeseq_from_text (& ts , 10 , multiroot_ex_nodes , multiroot_ex_edges , NULL , NULL ,
6022
- NULL , NULL , NULL , 0 );
6023
- verify_tree_diffs (& ts , 0 );
6024
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
6025
-
6026
- ret = tsk_treeseq_free (& ts );
6027
- CU_ASSERT_EQUAL (ret , 0 );
6028
- }
6029
-
6030
- static void
6031
- test_empty_diff_iter (void )
6032
- {
6033
- int ret ;
6034
- tsk_treeseq_t ts ;
6035
-
6036
- tsk_treeseq_from_text (
6037
- & ts , 10 , empty_ex_nodes , empty_ex_edges , NULL , NULL , NULL , NULL , NULL , 0 );
6038
- verify_tree_diffs (& ts , 0 );
6039
- verify_tree_diffs (& ts , TSK_INCLUDE_TERMINAL );
6040
-
6041
- ret = tsk_treeseq_free (& ts );
6042
- CU_ASSERT_EQUAL (ret , 0 );
6043
- }
6044
-
6045
5856
/*=======================================================
6046
5857
* Sample sets
6047
5858
*======================================================*/
@@ -8840,14 +8651,6 @@ main(int argc, char **argv)
8840
8651
8841
8652
/* multiroot tests */
8842
8653
{ "test_multiroot_mrca" , test_multiroot_mrca },
8843
- { "test_multiroot_diff_iter" , test_multiroot_diff_iter },
8844
-
8845
- /* Diff iter tests */
8846
- { "test_simple_diff_iter" , test_simple_diff_iter },
8847
- { "test_nonbinary_diff_iter" , test_nonbinary_diff_iter },
8848
- { "test_unary_diff_iter" , test_unary_diff_iter },
8849
- { "test_internal_sample_diff_iter" , test_internal_sample_diff_iter },
8850
- { "test_empty_diff_iter" , test_empty_diff_iter },
8851
8654
8852
8655
/* Sample sets */
8853
8656
{ "test_simple_sample_sets" , test_simple_sample_sets },
0 commit comments