mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-30 19:57:10 +01:00 
			
		
		
		
	 33ed1773f4
			
		
	
	33ed1773f4
	
	
	
		
			
			Now the order of stringification checks is 1) StringMaker specialization 2) operator<< toString overloads and specializations have been removed.
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "catch.hpp"
 | |
| 
 | |
| #include <tuple>
 | |
| 
 | |
| TEST_CASE( "tuple<>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<> type;
 | |
|     CHECK( "{ }" == ::Catch::Detail::stringify(type{}) );
 | |
|     type value {};
 | |
|     CHECK( "{ }" == ::Catch::Detail::stringify(value) );
 | |
| }
 | |
| 
 | |
| TEST_CASE( "tuple<int>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<int> type;
 | |
|     CHECK( "{ 0 }" == ::Catch::Detail::stringify(type{0}) );
 | |
| }
 | |
| 
 | |
| 
 | |
| TEST_CASE( "tuple<float,int>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<float,int> type;
 | |
|     CHECK( "1.2f" == ::Catch::Detail::stringify(float(1.2)) );
 | |
|     CHECK( "{ 1.2f, 0 }" == ::Catch::Detail::stringify(type{1.2f,0}) );
 | |
| }
 | |
| 
 | |
| TEST_CASE( "tuple<string,string>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<std::string,std::string> type;
 | |
|     CHECK( "{ \"hello\", \"world\" }" == ::Catch::Detail::stringify(type{"hello","world"}) );
 | |
| }
 | |
| 
 | |
| TEST_CASE( "tuple<tuple<int>,tuple<>,float>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<std::tuple<int>,std::tuple<>,float> type;
 | |
|     type value { std::tuple<int>{42}, {}, 1.2f };
 | |
|     CHECK( "{ { 42 }, { }, 1.2f }" == ::Catch::Detail::stringify(value) );
 | |
| }
 | |
| 
 | |
| TEST_CASE( "tuple<nullptr,int,const char *>", "[toString][tuple][c++11][.]" )
 | |
| {
 | |
|     typedef std::tuple<std::nullptr_t,int,const char *> type;
 | |
|     type value { nullptr, 42, "Catch me" };
 | |
|     CHECK( "{ nullptr, 42, \"Catch me\" }" == ::Catch::Detail::stringify(value) );
 | |
| }
 | |
| 
 |