blob: 700b180b9f03bcf03622b49d8f8fdc16734b87d1 [file] [log] [blame]
Phil Nashd944e692011-01-28 18:48:32 +00001/*
Phil Nashd944e692011-01-28 18:48:32 +00002 * Created by Phil on 28/01/2011.
3 * Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
4 *
5 * Distributed under the Boost Software License, Version 1.0. (See accompanying
6 * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Phil Nashd944e692011-01-28 18:48:32 +00007 */
8
Phil Nash46bcd4b2012-07-20 18:43:48 +01009// This define means we have to prefix all the CATCH macros with CATCH_
10// We're using it here to test it out
11#define CATCH_CONFIG_PREFIX_ALL
Phil Nash823ea3e2011-04-26 08:32:40 +010012#include "catch.hpp"
Phil Nashd944e692011-01-28 18:48:32 +000013
Phil Nashd06dced2012-05-09 08:17:51 +010014inline int multiply( int a, int b )
Phil Nashd944e692011-01-28 18:48:32 +000015{
16 return a*b;
17}
18
Phil Nash46bcd4b2012-07-20 18:43:48 +010019CATCH_TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" )
Phil Nashd944e692011-01-28 18:48:32 +000020{
21 using namespace Catch::Generators;
22
Phil Nash46bcd4b2012-07-20 18:43:48 +010023 int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) );
24 int j = CATCH_GENERATE( between( 100, 107 ) );
Phil Nashd944e692011-01-28 18:48:32 +000025
Phil Nash46bcd4b2012-07-20 18:43:48 +010026 CATCH_REQUIRE( multiply( i, 2 ) == i*2 );
27 CATCH_REQUIRE( multiply( j, 2 ) == j*2 );
Phil Nashd944e692011-01-28 18:48:32 +000028}