Asserter.h
Go to the documentation of this file.
/*
* Robot Testing Framework
*
* Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
*
* 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.1 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef ROBOTTESTINGFRAMEWORK_ASSERTER_H
#define ROBOTTESTINGFRAMEWORK_ASSERTER_H
#include <robottestingframework/Exception.h>
#include <robottestingframework/TestCase.h>
#include <robottestingframework/TestMessage.h>
#include <robottestingframework/TestSuite.h>
#if defined _MSC_VER && _MSC_VER <= 1800 //Visual Studio 12 or earlier has not [[noreturn]]
# define ROBOTTESTINGFRAMEWORK_NORETURN __declspec(noreturn)
#else
# define ROBOTTESTINGFRAMEWORK_NORETURN [[noreturn]]
#endif
namespace robottestingframework {
class Asserter
{
public:
ROBOTTESTINGFRAMEWORK_NORETURN static void fail(TestMessage msg);
static void fail(bool condition,
TestMessage msg);
ROBOTTESTINGFRAMEWORK_NORETURN static void error(TestMessage msg);
static void error(bool condition,
TestMessage msg);
static void report(TestMessage msg,
TestSuite* testsuite);
static void report(TestMessage msg,
TestCase* testcase);
static void testFail(bool condition,
TestMessage msg,
TestCase* testcase);
static void testCheck(bool condition,
TestMessage msg,
TestCase* testcase);
static std::string format(const char* msg, ...);
};
} // namespace robottestingframework
#endif // ROBOTTESTINGFRAMEWORK_ASSERTER_H
ROBOTTESTINGFRAMEWORK_NORETURN
#define ROBOTTESTINGFRAMEWORK_NORETURN
Definition: Asserter.h:33
Exception.h
TestCase.h
TestMessage.h
TestSuite.h
robottestingframework::Asserter
The Asserter class is used to throw exception or to report messages/failures to a TestResult.
Definition: Asserter.h:48
robottestingframework::Asserter::fail
static void fail(bool condition, TestMessage msg)
fail Throw a failure exception if the condition is not hold (it is not true).
robottestingframework::Asserter::report
static void report(TestMessage msg, TestCase *testcase)
report report a message to the result collector of the given TestCase
robottestingframework::Asserter::testCheck
static void testCheck(bool condition, TestMessage msg, TestCase *testcase)
Checks the given boolean condition and if it is not hold (it is not true) a failure message will be a...
robottestingframework::Asserter::error
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
robottestingframework::Asserter::fail
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.
robottestingframework::Asserter::report
static void report(TestMessage msg, TestSuite *testsuite)
report report a message to the result collector of the given TestSuite
robottestingframework::Asserter::format
static std::string format(const char *msg,...)
format can be used to format data to in the same way that sprintf formats.
robottestingframework::Asserter::error
static void error(bool condition, TestMessage msg)
error Throw an error exception if the condition is not hold (it is not true).
robottestingframework::Asserter::testFail
static void testFail(bool condition, TestMessage msg, TestCase *testcase)
Checks the given boolean condition and if it is not hold (it is not true) a failure message will be a...
robottestingframework::TestCase
The base class to implememnt a test case.
Definition: TestCase.h:42
robottestingframework::TestMessage
A formated message with details.
Definition: TestMessage.h:33
robottestingframework::TestSuite
The TestSuite holds a group of tests.
Definition: TestSuite.h:55
robottestingframework
Definition: Arguments.h:25