Multiple generators working and factored out a bit better

This commit is contained in:
Phil Nash
2011-01-27 22:29:36 +00:00
parent c2b96d7ddb
commit 5cad9d5a86
10 changed files with 340 additions and 25 deletions

View File

@@ -80,6 +80,24 @@ TEST_CASE( "./succeeding/Misc/stdout,stderr", "Sends stuff to stdout and stderr"
std::cerr << "An error";
}
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 );
}
// An unnamed test case. A name, of the form, "unnamed/#" is generated, where
// # is an incrementing integer
ANON_TEST_CASE()

View File

@@ -41,6 +41,7 @@
4A3BFFB8128DCF06005609E3 /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TestMain.cpp; sourceTree = "<group>"; };
4A3BFFF0128DD23C005609E3 /* catch_config.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_config.hpp; path = ../internal/catch_config.hpp; sourceTree = SOURCE_ROOT; };
4A6D514B12C8A547008F0415 /* catch_debugger.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_debugger.hpp; path = ../internal/catch_debugger.hpp; sourceTree = SOURCE_ROOT; };
4A8A68FF12F1F75100ACED26 /* catch_generators.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_generators.hpp; path = ../internal/catch_generators.hpp; sourceTree = SOURCE_ROOT; };
4A992A6512B2156C002B7B66 /* catch_xmlwriter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_xmlwriter.hpp; path = ../internal/catch_xmlwriter.hpp; sourceTree = SOURCE_ROOT; };
4A992A6612B21582002B7B66 /* catch_reporter_junit.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_reporter_junit.hpp; path = ../catch_reporter_junit.hpp; sourceTree = SOURCE_ROOT; };
4AA7EA9112A438C7005A0B97 /* MiscTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MiscTests.cpp; sourceTree = "<group>"; };
@@ -132,6 +133,7 @@
4AFC341912809A36003A0C29 /* catch_resultinfo.hpp */,
4AFC341A12809A36003A0C29 /* catch_runner_impl.hpp */,
4AD6783212D7ABB3005AAF59 /* catch_interfaces_runner.h */,
4A8A68FF12F1F75100ACED26 /* catch_generators.hpp */,
);
name = "Running & Results";
sourceTree = "<group>";