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 }
#define THROW_STACKED_EXCEPTION_CUSTOM_MSG2(e, stuff, param1)
Definition: exceptions.h:77
#define THROW_STACKED_EXCEPTION(e)
Definition: exceptions.h:53
#define ASSERT_EQUAL_(__A, __B)
Assert comparing two values, reporting their actual values upon failure.
Definition: exceptions.h:153
TEST(exception, stackedException)



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 7d5e6d718 Fri Aug 24 01:51:28 2018 +0200 at lun nov 2 08:35:50 CET 2020