split test.cpp to a file per class, add SWIG interface