diff options
Diffstat (limited to 'src/libmatrix/test/libmatrix_test.h')
-rw-r--r-- | src/libmatrix/test/libmatrix_test.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/libmatrix/test/libmatrix_test.h b/src/libmatrix/test/libmatrix_test.h new file mode 100644 index 0000000..4ae0a8a --- /dev/null +++ b/src/libmatrix/test/libmatrix_test.h @@ -0,0 +1,51 @@ +// +// Copyright (c) 2010 Linaro Limited +// +// All rights reserved. This program and the accompanying materials +// are made available under the terms of the MIT License which accompanies +// this distribution, and is available at +// http://www.opensource.org/licenses/mit-license.php +// +// Contributors: +// Jesse Barker - original implementation. +// +#ifndef LIBMATRIX_TEST_H_ +#define LIBMATRIX_TEST_H_ + +class Options +{ + Options(); + static const std::string verbose_name_; + static const std::string help_name_; + std::string app_name_; + bool show_help_; + bool verbose_; +public: + Options(const std::string& app_name) : + app_name_(app_name), + show_help_(false), + verbose_(false) {} + ~Options() {} + bool beVerbose() const { return verbose_; } + bool showHelp() const { return show_help_; } + void parseArgs(int argc, char** argv); + void printUsage(); +}; + +class MatrixTest +{ + std::string name_; +protected: + bool pass_; + MatrixTest(); +public: + MatrixTest(const std::string& name) : + name_(name), + pass_(false) {} + ~MatrixTest(); + const std::string& name() const { return name_; } + virtual void run(const Options& options) = 0; + const bool passed() const { return pass_; } +}; + +#endif // LIBMATRIX_TEST_H_ |