added test cases based on the nodeunit testing library. fixed some cricle erase path issues