add test directories and move src/test to test
add automatically test script.
modify CMakeLists in 3rdparty, fix compile bug resulting from makefile changes