X-Git-Url: http://git.euphorik.ch/index.cgi?a=blobdiff_plain;f=WCudaMSE%2FAPI_CppTest%2FSRC%2Fcore%2Fcpptest-compileroutput.h;fp=WCudaMSE%2FAPI_CppTest%2FSRC%2Fcore%2Fcpptest-compileroutput.h;h=35a6feb28a2e172bea23b544a0df938c5e200d65;hb=8d08c12b29c2a14684f35c023ee39e694bb80d25;hp=0000000000000000000000000000000000000000;hpb=226de81f7e1f1fbf4ac79d0d089e8a05ec7159a0;p=GPU.git diff --git a/WCudaMSE/API_CppTest/SRC/core/cpptest-compileroutput.h b/WCudaMSE/API_CppTest/SRC/core/cpptest-compileroutput.h new file mode 100755 index 0000000..35a6feb --- /dev/null +++ b/WCudaMSE/API_CppTest/SRC/core/cpptest-compileroutput.h @@ -0,0 +1,112 @@ +// --- +// +// $Id: cpptest-compileroutput.h,v 1.3 2005/06/08 08:08:06 nilu Exp $ +// +// CppTest - A C++ Unit Testing Framework +// Copyright (c) 2003 Niklas Lundell +// +// --- +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the +// Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. +// +// --- + +/** \file */ + +#ifndef CPPTEST_COMPILEROUTPUT_H +#define CPPTEST_COMPILEROUTPUT_H + +#include +#include + +#include "cpptest-output.h" + +namespace Test +{ + /// \brief Compiler-like output handler. + /// + /// %Test suite output handler that only outputs failures in compiler + /// warning/error format. This way, you can use your IDE to browse between + /// failures. + /// + /// The output format is configurable to be able to emulate different + /// compiler outputs. The following modifiers exist: + /// - \e %file Outputs the file containing the test function. + /// - \e %line Line number for the the test function. + /// - \e %text Expression (or message) that caused the assertment. + /// Note that each modifier can only be specified once. + /// + class CompilerOutput : public Output + { + public: + /// \brief Compiler output exception. + /// + /// Indicates that an invalid message format was given when creating + /// a compiler output. The failing format may be retrieved using the + /// what() method. + /// + class InvalidFormat : public std::logic_error + { + public: + InvalidFormat(const std::string& what) + : std::logic_error(what) {} + }; + + /// Pre-defined compiler output formats. + /// + enum Format + { + /// Generic compiler format, which equals: + /// %%file:%%line: %%text + /// + Generic, + + /// + /// Borland C++ Compiler (BCC) format, which equals: + /// Error cpptest %%file %%line: %%text. + /// + BCC, + + /// GNU Compiler Collection + /// (GCC) format, which equals: + /// %%file:%%line: %%text + /// + GCC, + + /// Microsoft Visual C++ + /// (MSVC) format, which equals: + /// %%file(%%line) : %%text + /// + MSVC + }; + + explicit CompilerOutput(Format format = Generic, + std::ostream& stream = std::cout); + + explicit CompilerOutput(const std::string& format, + std::ostream& stream = std::cout); + + virtual void assertment(const Source& s); + + private: + std::string _format; + std::ostream& _stream; + }; + +} // namespace Test + +#endif // #ifndef CPPTEST_COMPILEROUTPUT_H +