2011-01-28 19:48:32 +01:00
|
|
|
/*
|
|
|
|
* GeneratorTests.cpp
|
|
|
|
* Catch - Test
|
|
|
|
*
|
|
|
|
* Created by Phil on 28/01/2011.
|
|
|
|
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2011-04-26 09:32:40 +02:00
|
|
|
#include "catch.hpp"
|
2011-01-28 19:48:32 +01:00
|
|
|
|
2012-05-09 09:17:51 +02:00
|
|
|
inline int multiply( int a, int b )
|
2011-01-28 19:48:32 +01:00
|
|
|
{
|
|
|
|
return a*b;
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" )
|
|
|
|
{
|
|
|
|
using namespace Catch::Generators;
|
|
|
|
|
2012-05-09 09:17:51 +02:00
|
|
|
int i = GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
|
|
|
|
int j = GENERATE( between( 100, 107 ) );
|
2011-01-28 19:48:32 +01:00
|
|
|
|
|
|
|
REQUIRE( multiply( i, 2 ) == i*2 );
|
|
|
|
REQUIRE( multiply( j, 2 ) == j*2 );
|
|
|
|
}
|