dapted tests

cpp tests have been adapted and tested for memory errors in valgrind, the code is clean