Record Case Detail

Notes

This function is in beta test. Please help improve it in the issues here.

Stderr

=================================================================
==112323==ERROR: AddressSanitizer: heap-use-after-free on address 0x603000000498 at pc 0x561b6bbb1a62 bp 0x7ffde4a21f00 sp 0x7ffde4a21ef0
READ of size 8 at 0x603000000498 thread T0
    #0 0x561b6bbb1a61 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #1 0x561b6bbb1a78 in BinaryTree::removeAll(TreeNode*) /in/ex6.cpp:112
    #2 0x561b6bbb058e in BinaryTree::~BinaryTree() /in/ex6.cpp:25
    #3 0x561b6bbb0a3c in BinaryTree::sum() const /in/ex6.cpp:50
    #4 0x561b6bbb0a2a in BinaryTree::sum() const /in/ex6.cpp:51
    #5 0x561b6bbb88ab in test12() /in/compile/TestFunctions.cpp:198
    #6 0x561b6bbc3b0c in std::_Function_handler<void (), void (*)()>::_M_invoke(std::_Any_data const&) /usr/include/c++/7/bits/std_function.h:316
    #7 0x561b6bbc37e6 in std::function<void ()>::operator()() const /usr/include/c++/7/bits/std_function.h:706
    #8 0x561b6bbb26b5 in runTests(int) /in/compile/TestFunctions.cpp:20
    #9 0x561b6bbafe70 in main /in/comp

Hints

Your answer may be identical to the JOJ answer in the first several lines.

However, the main problem you meet now is Runtime Error. And the exit code of your program is 1, which should be 0.

Please double check your code to solve this problem and try again.

Your Answer

Test 12: Deep Copy Check for Random Tree

JOJ Answer

Test 12: Deep Copy Check for Random Tree
Original Sum: 599, Copy Sum: 599
15 86 69 72 9 65 63 74 48 98 Modifying Copy (Clearing Tree)...
Original Tree after Copy Cleared: 15 86 69 72 9 65 63 74 48 98