Finished the tests to this function.
close #6