From a3f0af934e387ba259919f0b72b42120eef3bc5c Mon Sep 17 00:00:00 2001 From: weidai Date: Fri, 6 Dec 2002 22:02:46 +0000 Subject: add script-driven testing git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk/c5@24 57ff6487-cd31-0410-9ec3-f628ee90f5f0 --- test.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test.cpp') diff --git a/test.cpp b/test.cpp index 77719fe..926d98d 100644 --- a/test.cpp +++ b/test.cpp @@ -19,6 +19,7 @@ #include "osrng.h" #include "wait.h" #include "fips140.h" +#include "factory.h" #include "validate.h" #include "bench.h" @@ -78,6 +79,11 @@ void FIPS140_GenerateRandomFiles(); bool Validate(int, bool, const char *); +void RegisterFactories(); +bool RunTestDataFile(const char *filename); + +int (*AdhocTest)(int argc, char *argv[]) = NULL; + #ifdef __BCPLUSPLUS__ int cmain(int argc, char *argv[]) #elif defined(_MSC_VER) @@ -199,6 +205,10 @@ int main(int argc, char *argv[]) return 0; case 't': { + if (command == "tv") + { + return !RunTestDataFile(argv[2]); + } // VC60 workaround: use char array instead of std::string to workaround MSVC's getline bug char passPhrase[MAX_PHRASE_LENGTH], plaintext[1024]; @@ -277,6 +287,11 @@ int main(int argc, char *argv[]) else if (command == "ft") ForwardTcpPort(argv[2], argv[3], argv[4]); return 0; + case 'a': + if (AdhocTest) + return (*AdhocTest)(argc, argv); + else + return 0; default: FileSource usage("usage.dat", true, new FileSink(cout)); return 1; -- cgit v1.2.1