Fix some memory management bugs with trees

This commit is contained in:
Max Brunsfeld 2014-03-01 00:25:05 -08:00
parent 21c0f51b84
commit ded54a3a1a
5 changed files with 32 additions and 32 deletions

View file

@ -16,8 +16,8 @@ describe("trees", []() {
ts_tree *tree1, *parent1;
before_each([&]() {
tree1 = ts_tree_make_leaf(cat);
parent1 = ts_tree_make_node(dog, 1, &tree1);
tree1 = ts_tree_make_leaf(cat, 0, 0);
parent1 = ts_tree_make_node(dog, 1, tree_array({ tree1 }));
});
after_each([&]() {
@ -27,7 +27,7 @@ describe("trees", []() {
describe("equality", [&]() {
it("returns true for identical trees", [&]() {
ts_tree *tree2 = ts_tree_make_leaf(cat);
ts_tree *tree2 = ts_tree_make_leaf(cat, 0, 0);
AssertThat(ts_tree_equals(tree1, tree2), Equals(1));
ts_tree *parent2 = ts_tree_make_node(dog, 1, tree_array({ tree2 }));
@ -38,7 +38,7 @@ describe("trees", []() {
});
it("returns false for different trees", [&]() {
ts_tree *different_tree = ts_tree_make_leaf(pig);
ts_tree *different_tree = ts_tree_make_leaf(pig, 0, 0);
AssertThat(ts_tree_equals(tree1, different_tree), Equals(0));
ts_tree *different_parent = ts_tree_make_node(dog, 1, tree_array({ different_tree }));