modify to be a library
add cppunittest