Sha256: e1ca43625a610cd5cabca25bc2ca7bd3d712ad3fee8ae0abc4934a1ef6ad3037
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
/* * 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) */ // This define means we have to prefix all the CATCH macros with CATCH_ // We're using it here to test it out #define CATCH_CONFIG_PREFIX_ALL #include "catch.hpp" inline int multiply( int a, int b ) { return a*b; } CATCH_TEST_CASE( "./succeeding/generators/1", "Generators over two ranges" ) { using namespace Catch::Generators; int i = CATCH_GENERATE( between( 1, 5 ).then( values( 15, 20, 21 ).then( 36 ) ) ); int j = CATCH_GENERATE( between( 100, 107 ) ); CATCH_REQUIRE( multiply( i, 2 ) == i*2 ); CATCH_REQUIRE( multiply( j, 2 ) == j*2 ); } struct IntPair { int first, second; }; CATCH_TEST_CASE( "./succeeding/generators/2", "Generator over a range of pairs" ) { using namespace Catch::Generators; IntPair p[] = { { 0, 1 }, { 2, 3 } }; IntPair* i = CATCH_GENERATE( between( p, &p[1] ) ); CATCH_REQUIRE( i->first == i->second-1 ); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
redsnow-0.3.2 | ext/snowcrash/test/vendor/Catch/projects/SelfTest/GeneratorTests.cpp |