add test.c and CMakeLists.txt for C API