Improved realloc and also the test.

This test is not triial! And it can be improved a lot.
Added TODO.