diff --git a/libretroshare/src/tests/util/dirtest.cc b/libretroshare/src/tests/util/dirtest.cc index b8857b71b..862a77913 100644 --- a/libretroshare/src/tests/util/dirtest.cc +++ b/libretroshare/src/tests/util/dirtest.cc @@ -27,6 +27,7 @@ #include "util/rsdir.h" +#include "util/utest.h" #include #include @@ -34,6 +35,8 @@ bool testRsDirUtils(std::string path); +INITTEST() ; + int main() { @@ -62,6 +65,10 @@ int main() { testRsDirUtils(*it); } + + FINALREPORT("dirtest"); + + return TESTRESULT() ; } bool testRsDirUtils(std::string path) diff --git a/libretroshare/src/tests/util/sha1_test.cc b/libretroshare/src/tests/util/sha1_test.cc index 1b8b5293b..bd95dc12d 100644 --- a/libretroshare/src/tests/util/sha1_test.cc +++ b/libretroshare/src/tests/util/sha1_test.cc @@ -27,7 +27,8 @@ #include "util/rsdir.h" -#include "../common/argstream.h" +#include "util/utest.h" +#include #include #include @@ -40,6 +41,8 @@ void printHelp(int argc,char *argv[]) std::cerr << "Usage: " << argv[0] << " [test file]" << std::endl ; } +INITTEST() ; + int main(int argc,char *argv[]) { std::string inputfile ; @@ -55,11 +58,7 @@ int main(int argc,char *argv[]) FILE *f = RsDirUtil::rs_fopen(inputfile.c_str(),"r") ; - if(f == NULL) - { - std::cerr << "Cannot open file " << inputfile << " for read !" << std::endl; - return -1 ; - } + CHECK(f != NULL) ; std::cerr << "Testing sha1" << std::endl; uint32_t SIZE = 1024*1024 ; @@ -79,13 +78,11 @@ int main(int argc,char *argv[]) RsDirUtil::getFileHash(inputfile.c_str(),hash,size) ; std::cerr << "Old method : " << hash << std::endl; - if(hash != sum.toStdString()) - return -1 ; + CHECK(hash == sum.toStdString()) ; Sha1CheckSum H(hash) ; std::cerr << "Hashed transformed: " << H.toStdString() << std::endl; - if(hash != H.toStdString()) - return -1 ; + CHECK(hash == H.toStdString()) ; std::cerr << "Computing all chunk hashes:" << std::endl; @@ -100,6 +97,8 @@ int main(int argc,char *argv[]) } fclose(f) ; - return 0 ; + + FINALREPORT("Sha1Test") ; + return TESTRESULT() ; }