Finished the tests to the balance function. close #10