TheEvergreenStateCollege / smarty-plants

Plant genome sequencing
2 stars 2 forks source link

(Temporary) Reorganize howtocpp suffix tree printout and Rust suffix tree tests. #20

Closed learner-long-life closed 2 months ago

learner-long-life commented 2 months ago

Tentative code change to better understand how to add tests to suffix_tree_rewrite branch.

Move howtocpp into its own directory and Makefile for compiling and testing it. Move the suffix tree tests into the same file as the code to match edit_distance tests (yet to be merged).

Sort child nodes to bring closer to alignment with how Rust suffix trees print out, for testing.

Current unit tests:

Differs in child node IDs, I could use some help to know whether we should be changing Rust code to match CPP suffix tree node IDs, or whether it's more productive to instrument the Rust SuffixTree implementation to test the tree structure directly.

Expected CPP suffix tree printout

1   |            | Root   | Root   | No SL  | [5, 7, 9]
2   | cxaca      | 3      | End    | No SL  | []
3   | cxaca      | 3      | End    | No SL  | []
4   | cxaca      | 3      | End    | No SL  | []
5   | c          | 2      | 3      | 1      | [4, 6, 11]
6   | xaca       | 4      | End    | No SL  | []
7   | xac        | 0      | 3      | 9      | [2, 8]
8   | a          | 7      | End    | No SL  | []
9   | ac         | 1      | 3      | 5      | [3, 10]
10  | a          | 7      | End    | No SL  | []
11  | a          | 7      | End    | No SL  | []

Current Rust suffix tree printout

Suffix tree for: xaccxaca
1   |            | Root   | Root   | No SL  | [7, 9, 11]
2   | cxaca      | 3      | End    | No SL  | []
3   | cxaca      | 3      | End    | No SL  | []
4   | cxaca      | 3      | End    | No SL  | []
5   |            | 3      | 2      | No SL  | [6, 4]
6   | xaca       | 4      | End    | No SL  | []
7   | xac        | 0      | 2      | 9      | [8, 2]
8   | a          | 7      | End    | No SL  | []
9   | ac         | 1      | 2      | 11     | [10, 3]
10  | a          | 7      | End    | No SL  | []
11  | c          | 2      | 2      | No SL  | [12, 5]
12  | a          | 7      | End    | No SL  | []