diff options
| author | Phil Nash | 2011-01-28 18:48:32 +0000 |
|---|---|---|
| committer | Phil Nash | 2011-01-28 18:48:32 +0000 |
| commit | d944e69b18815f42d1a3f61620915bcaf5b951da (patch) | |
| tree | 5edccb244c9f7290feb121bfedc2a32d3f9f7ede /Test/GeneratorTests.cpp | |
| parent | ffcde2dd0e7581a6ff0fe1cce050fcd3eb91ae70 (diff) | |
| download | catch3-d944e69b18815f42d1a3f61620915bcaf5b951da.tar.gz | |
Moved generator tests into their own file
Diffstat (limited to 'Test/GeneratorTests.cpp')
| -rw-r--r-- | Test/GeneratorTests.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/Test/GeneratorTests.cpp b/Test/GeneratorTests.cpp new file mode 100644 index 00000000..8dec53f5 --- /dev/null +++ b/Test/GeneratorTests.cpp @@ -0,0 +1,29 @@ +/* + * 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) + * + */ + +#include "../catch.hpp" + +size_t multiply( int a, int b ) +{ + return a*b; +} + +TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" ) +{ + using namespace Catch::Generators; + + size_t i = GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) ); + size_t j = GENERATE( between( 100, 107 ) ); + + REQUIRE( multiply( i, 2 ) == i*2 ); + REQUIRE( multiply( j, 2 ) == j*2 ); +} |