| 
									
										
										
										
											2017-10-09 12:31:22 +02:00
										 |  |  | #define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER
 | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | #include "catch.hpp"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-25 12:40:52 +01:00
										 |  |  | #include <tuple>
 | 
					
						
							| 
									
										
										
										
											2015-05-19 18:23:52 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<> type; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ }" == ::Catch::Detail::stringify(type{}) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  |     type value {}; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ }" == ::Catch::Detail::stringify(value) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<int>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<int> type; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<float,int>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<float,int> type; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) ); | 
					
						
							|  |  |  |     CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<string,string>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<std::string,std::string> type; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<tuple<int>,tuple<>,float>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<std::tuple<int>,std::tuple<>,float> type; | 
					
						
							| 
									
										
										
										
											2014-09-04 01:05:51 +01:00
										 |  |  |     type value { std::tuple<int>{42}, {}, 1.2f }; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-13 08:52:51 +01:00
										 |  |  | TEST_CASE( "tuple<nullptr,int,const char *>", "[toString][tuple]" ) | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | { | 
					
						
							|  |  |  |     typedef std::tuple<std::nullptr_t,int,const char *> type; | 
					
						
							|  |  |  |     type value { nullptr, 42, "Catch me" }; | 
					
						
							| 
									
										
										
										
											2017-05-02 23:51:03 +02:00
										 |  |  |     CHECK( "{ nullptr, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) ); | 
					
						
							| 
									
										
										
										
											2014-09-04 00:32:05 +01:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |