RobotTestingFramework 2.0.1
Robot Testing Framework
Loading...
Searching...
No Matches
Asserter.h
Go to the documentation of this file.
1/*
2 * Robot Testing Framework
3 *
4 * Copyright (C) 2015-2019 Istituto Italiano di Tecnologia (IIT)
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21
22#ifndef ROBOTTESTINGFRAMEWORK_ASSERTER_H
23#define ROBOTTESTINGFRAMEWORK_ASSERTER_H
24
29
30#if defined _MSC_VER && _MSC_VER <= 1800 //Visual Studio 12 or earlier has not [[noreturn]]
31# define ROBOTTESTINGFRAMEWORK_NORETURN __declspec(noreturn)
32#else
33# define ROBOTTESTINGFRAMEWORK_NORETURN [[noreturn]]
34#endif
35
36
37namespace robottestingframework {
38
48{
49public:
56
63 static void fail(bool condition,
64 TestMessage msg);
65
72
79 static void error(bool condition,
80 TestMessage msg);
81
89 static void report(TestMessage msg,
90 TestSuite* testsuite);
91
99 static void report(TestMessage msg,
100 TestCase* testcase);
101
111 static void testFail(bool condition,
112 TestMessage msg,
113 TestCase* testcase);
114
125 static void testCheck(bool condition,
126 TestMessage msg,
127 TestCase* testcase);
128
135 static std::string format(const char* msg, ...);
136};
137
138} // namespace robottestingframework
139
140#endif // ROBOTTESTINGFRAMEWORK_ASSERTER_H
#define ROBOTTESTINGFRAMEWORK_NORETURN
Definition Asserter.h:33
The Asserter class is used to throw exception or to report messages/failures to a TestResult.
Definition Asserter.h:48
static void fail(bool condition, TestMessage msg)
fail Throw a failure exception if the condition is not hold (it is not true).
static void report(TestMessage msg, TestCase *testcase)
report report a message to the result collector of the given TestCase
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...
static ROBOTTESTINGFRAMEWORK_NORETURN void error(TestMessage msg)
error Throw an error exception with the given message.
static ROBOTTESTINGFRAMEWORK_NORETURN void fail(TestMessage msg)
fail Throw a failure exception with the given message.
static void report(TestMessage msg, TestSuite *testsuite)
report report a message to the result collector of the given TestSuite
static std::string format(const char *msg,...)
format can be used to format data to in the same way that sprintf formats.
static void error(bool condition, TestMessage msg)
error Throw an error exception if the condition is not hold (it is not true).
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...
The base class to implememnt a test case.
Definition TestCase.h:42
A formated message with details.
Definition TestMessage.h:33
The TestSuite holds a group of tests.
Definition TestSuite.h:55