| 
									
										
										
										
											2018-03-04 09:16:51 -08:00
										 |  |  | // Formatting library for C++ - test version of FMT_ASSERT
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Copyright (c) 2012 - present, Victor Zverovich
 | 
					
						
							|  |  |  | // All rights reserved.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // For the license information refer to format.h.
 | 
					
						
							| 
									
										
										
										
											2015-06-22 08:17:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef FMT_TEST_ASSERT_H
 | 
					
						
							|  |  |  | #define FMT_TEST_ASSERT_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 09:24:54 -07:00
										 |  |  | #include <stdexcept>
 | 
					
						
							| 
									
										
										
										
											2015-06-22 08:17:23 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-22 09:24:54 -07:00
										 |  |  | class AssertionFailure : public std::logic_error { | 
					
						
							|  |  |  |  public: | 
					
						
							|  |  |  |   explicit AssertionFailure(const char *message) : std::logic_error(message) {} | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2015-06-22 08:17:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define FMT_ASSERT(condition, message) \
 | 
					
						
							| 
									
										
										
										
											2015-06-22 09:24:54 -07:00
										 |  |  |   if (!(condition)) throw AssertionFailure(message); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "gtest-extra.h"
 | 
					
						
							| 
									
										
										
										
											2015-06-22 08:17:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | // Expects an assertion failure.
 | 
					
						
							|  |  |  | #define EXPECT_ASSERT(stmt, message) \
 | 
					
						
							| 
									
										
										
										
											2015-06-22 09:24:54 -07:00
										 |  |  |   EXPECT_THROW_MSG(stmt, AssertionFailure, message) | 
					
						
							| 
									
										
										
										
											2015-06-22 08:17:23 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #endif  // FMT_TEST_ASSERT_H
 |