blob: 73378323078b0fcac2cf1a1d9b8084a08285b0bd [file] [log] [blame]
Phil Nashd8026002010-11-09 23:24:00 +00001/*
2 * TrickyTests.cpp
3 * Catch - Test
4 *
5 * Created by Phil on 09/11/2010.
6 * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
7 *
8 * Distributed under the Boost Software License, Version 1.0. (See accompanying
9 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 *
11 */
12
Phil Nash7e8cfa72010-11-12 08:12:01 +000013#include "../catch.hpp"
Phil Nashd8026002010-11-09 23:24:00 +000014
15namespace Catch
16{
17 template<>
18 std::string toString<std::pair<int, int> >( const std::pair<int, int>& value )
19 {
20 std::ostringstream oss;
21 oss << "std::pair( " << value.first << ", " << value.second << " )";
22 return oss.str();
23
24 }
25}
26
Phil Nash3d0fed72010-11-10 19:18:46 +000027TEST_CASE( "succeeding/Tricky/std::pair", "Parsing a std::pair" )
Phil Nashd8026002010-11-09 23:24:00 +000028{
29 std::pair<int, int> aNicePair( 1, 2 );
30
31 // !TBD: would be nice if this could compile without the extra parentheses
32 EXPECT( (std::pair<int, int>( 1, 2 )) == aNicePair );
33
Phil Nash3d0fed72010-11-10 19:18:46 +000034}
35
36TEST_CASE( "succeeding/Tricky/complex lhs", "Where the LHS is not a simple value" )
37{
38 int a = 1;
39 int b = 2;
40
Phil Nash48a70222010-11-11 07:21:57 +000041 // This only captures part of the expression, but issues a warning about the rest
Phil Nashc435f4c2010-11-11 07:22:46 +000042 EXPECT( a == 2 || b == 2 );
Phil Nash92f2d322010-11-11 20:37:46 +000043}