Main MRPT website > C++ reference for MRPT 1.9.9
exception_unittest.cpp
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2018, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 #include <mrpt/core/exceptions.h>
11 #include <gtest/gtest.h>
12 #include <sstream>
13 
14 TEST(exception, stackedException)
15 {
16  EXPECT_THROW({
17  THROW_STACKED_EXCEPTION(std::runtime_error("stacked"));
18  }, std::logic_error);
19 }
20 
21 TEST(exception, assertException)
22 {
23  bool trueValue = true;
24  bool falseValue = false;
25  EXPECT_THROW({
26  ASSERT_EQUAL_(trueValue, falseValue);
27  }, std::logic_error);
28 }
29 
30 TEST(exception, stackedExceptionCustomMsg)
31 {
32  EXPECT_THROW({
33  THROW_STACKED_EXCEPTION_CUSTOM_MSG2(std::runtime_error("stacked"),
34  "Foo %s\n", "bar");
35  }, std::logic_error);
36 }
exceptions.h
TEST
TEST(exception, stackedException)
Definition: exception_unittest.cpp:14
THROW_STACKED_EXCEPTION
#define THROW_STACKED_EXCEPTION(e)
Definition: exceptions.h:53
ASSERT_EQUAL_
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
Definition: exceptions.h:153
THROW_STACKED_EXCEPTION_CUSTOM_MSG2
#define THROW_STACKED_EXCEPTION_CUSTOM_MSG2(e, stuff, param1)
Definition: exceptions.h:77



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST