Skip to content

Commit 841c11a

Browse files
Minor updates to subset
- Move C code to more logical locations. - Update new method signatures to avoid hard-coding defaults. - Various minor rephrasings. - Fill in gap in C test coverage.
1 parent 3eee1a6 commit 841c11a

File tree

7 files changed

+191
-182
lines changed

7 files changed

+191
-182
lines changed

c/tests/test_tables.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4077,7 +4077,8 @@ test_sort_tables_canonical(void)
40774077
"2 2 1 -1 2\n"
40784078
"1 1 5 7 0.5\n"
40794079
"1 2 1 -1 2\n"
4080-
"1 1 4 2 0.5\n";
4080+
"1 1 4 2 0.5\n"
4081+
"1 1 6 7 0.5\n";
40814082
const char *nodes_sorted = "1 0 -1 0\n"
40824083
"1 0 0 1\n"
40834084
"1 0 1 -1\n"
@@ -4098,7 +4099,8 @@ test_sort_tables_canonical(void)
40984099
"2 4 3 -1 3\n"
40994100
"2 2 1 -1 2\n"
41004101
"2 1 4 4 0.5\n"
4101-
"2 1 5 6 0.5\n";
4102+
"2 1 5 6 0.5\n"
4103+
"2 1 6 6 0.5\n";
41024104
const char *individuals_sorted_kept = "0 1.0\n"
41034105
"0 3.0\n"
41044106
"0 2.0\n"
@@ -4123,7 +4125,7 @@ test_sort_tables_canonical(void)
41234125
parse_sites(sites, &t1.sites);
41244126
CU_ASSERT_EQUAL_FATAL(t1.sites.num_rows, 3);
41254127
parse_mutations(mutations, &t1.mutations);
4126-
CU_ASSERT_EQUAL_FATAL(t1.mutations.num_rows, 8);
4128+
CU_ASSERT_EQUAL_FATAL(t1.mutations.num_rows, 9);
41274129

41284130
ret = tsk_table_collection_canonicalise(&t1, 0);
41294131
CU_ASSERT_EQUAL_FATAL(ret, 0);
@@ -4139,7 +4141,7 @@ test_sort_tables_canonical(void)
41394141
parse_sites(sites_sorted, &t2.sites);
41404142
parse_mutations(mutations_sorted, &t2.mutations);
41414143
CU_ASSERT_EQUAL_FATAL(t2.sites.num_rows, 3);
4142-
CU_ASSERT_EQUAL_FATAL(t2.mutations.num_rows, 8);
4144+
CU_ASSERT_EQUAL_FATAL(t2.mutations.num_rows, 9);
41434145

41444146
CU_ASSERT_TRUE(tsk_table_collection_equals(&t1, &t2, 0));
41454147

c/tests/testlib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ parse_mutations(const char *text, tsk_mutation_table_t *mutation_table)
543543
double time;
544544
char derived_state[MAX_LINE];
545545

546+
/* site, node, derived_state, [parent, time] */
546547
c = 0;
547548
while (text[c] != '\0') {
548549
/* Fill in the line */

0 commit comments

Comments
 (0)