mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-17 03:02:24 +01:00
Test toString(pair<vector>)
This commit is contained in:
parent
2f854336d9
commit
c571f0a597
@ -31,3 +31,22 @@ TEST_CASE( "pair<pair<int,const char *,pair<std::string,int> > -> toString", "[t
|
|||||||
std::pair<left_t,right_t> pair( left, right );
|
std::pair<left_t,right_t> pair( left, right );
|
||||||
REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" );
|
REQUIRE( Catch::toString( pair ) == "{ { 42, \"Arthur\" }, { \"Ford\", 24 } }" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// More contrivance: A pair of vectors...
|
||||||
|
TEST_CASE( "toString( pair<vector,vector> )", "[toString][pair][vector]" )
|
||||||
|
{
|
||||||
|
typedef std::pair<std::vector<int>,std::vector<float> > type;
|
||||||
|
|
||||||
|
int aint[] = { 4, 2 };
|
||||||
|
std::vector<int> vint( std::begin(aint), std::end(aint) );
|
||||||
|
CHECK( "{ 4, 2 }" == Catch::toString(vint) );
|
||||||
|
|
||||||
|
float afloat[] = { 0.4f, 0.2f };
|
||||||
|
std::vector<float> vfloat( std::begin(afloat), std::end(afloat) );
|
||||||
|
CHECK( "{ 0.4f, 0.2f }" == Catch::toString(vfloat) );
|
||||||
|
|
||||||
|
type value( vint, vfloat );
|
||||||
|
CHECK( "{ { 4, 2 }, { 0.4f, 0.2f } }" == Catch::toString(value) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user