problem-specifications
problem-specifications copied to clipboard
[Binary Search Tree][c language] new test case
Inspired by @siebenschlaefer comment https://exercism.io/my/solutions/b6f9db46186547ba9a7bbebf3f193078?iteration_idx=1
It looks like there is a missing test case:
int tree_data[] = { 3, 1, 2 };
node_t *tree = build_tree(
tree_data, ARRAY_SIZE(tree_data));
int expected[] = { 1, 2, 3 };
int *actual = sorted_data(tree);
TEST_ASSERT_EQUAL_INT_ARRAY(
expected, actual,
ARRAY_SIZE(expected));
free_tree(tree);
free(actual);
I had created initially a wrong algorithm for the left and right branches. Where the left branch passe because there was a missing test case, while the right branch I fixed. Adding this test case will help to write a proper implementation.