From e46a70f8291b6673f82b156b53ad5f5df8dc48a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 27 Jan 2019 19:46:28 +0100 Subject: [PATCH] Redo generator interface --- include/internal/catch_generators.cpp | 24 +- include/internal/catch_generators.hpp | 244 ++- .../catch_interfaces_generatortracker.h | 18 +- include/internal/catch_run_context.cpp | 20 +- include/internal/catch_test_case_tracker.cpp | 2 +- include/internal/catch_test_case_tracker.h | 4 +- .../Baselines/compact.sw.approved.txt | 270 ++-- .../Baselines/console.std.approved.txt | 4 +- .../Baselines/console.sw.approved.txt | 1388 ++++++----------- .../SelfTest/Baselines/junit.sw.approved.txt | 19 +- .../SelfTest/Baselines/xml.sw.approved.txt | 1085 ++++++------- .../GeneratorsImpl.tests.cpp | 121 +- .../SelfTest/UsageTests/Generators.tests.cpp | 99 +- 13 files changed, 1284 insertions(+), 2014 deletions(-) diff --git a/include/internal/catch_generators.cpp b/include/internal/catch_generators.cpp index 786da736..de6dc1fe 100644 --- a/include/internal/catch_generators.cpp +++ b/include/internal/catch_generators.cpp @@ -18,33 +18,11 @@ IGeneratorTracker::~IGeneratorTracker() {} namespace Generators { - GeneratorBase::~GeneratorBase() {} - - std::vector randomiseIndices( size_t selectionSize, size_t sourceSize ) { - - assert( selectionSize <= sourceSize ); - std::vector indices; - indices.reserve( selectionSize ); - std::uniform_int_distribution uid( 0, sourceSize-1 ); - - std::set seen; - // !TBD: improve this algorithm - while( indices.size() < selectionSize ) { - auto index = uid( rng() ); - if( seen.insert( index ).second ) - indices.push_back( index ); - } - return indices; - } + GeneratorUntypedBase::~GeneratorUntypedBase() {} auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { return getResultCapture().acquireGeneratorTracker( lineInfo ); } - template<> - auto all() -> Generator { - return range( std::numeric_limits::min(), std::numeric_limits::max() ); - } - } // namespace Generators } // namespace Catch diff --git a/include/internal/catch_generators.hpp b/include/internal/catch_generators.hpp index 4a446be1..92542fde 100644 --- a/include/internal/catch_generators.hpp +++ b/include/internal/catch_generators.hpp @@ -29,199 +29,140 @@ namespace Generators { } template - struct IGenerator { - virtual ~IGenerator() {} - virtual auto get( size_t index ) const -> T = 0; + struct IGenerator : GeneratorUntypedBase { + virtual ~IGenerator() = default; + + // Returns the current element of the generator + // + // \Precondition The generator is either freshly constructed, + // or the last call to `next()` returned true + virtual T const& get() const = 0; + using type = T; }; template - class SingleValueGenerator : public IGenerator { + class SingleValueGenerator final : public IGenerator { T m_value; public: - SingleValueGenerator( T const& value ) : m_value( value ) {} + SingleValueGenerator(T const& value) : m_value( value ) {} + SingleValueGenerator(T&& value) : m_value(std::move(value)) {} - auto get( size_t ) const -> T override { + T const& get() const override { return m_value; } + bool next() override { + return false; + } }; template - class FixedValuesGenerator : public IGenerator { + class FixedValuesGenerator final : public IGenerator { std::vector m_values; - + size_t m_idx = 0; public: FixedValuesGenerator( std::initializer_list values ) : m_values( values ) {} - auto get( size_t index ) const -> T override { - return m_values[index]; + T const& get() const override { + return m_values[m_idx]; + } + bool next() override { + ++m_idx; + return m_idx < m_values.size(); } }; - template - class RangeGenerator : public IGenerator { - T const m_first; - T const m_last; - - public: - RangeGenerator( T const& first, T const& last ) : m_first( first ), m_last( last ) { - assert( m_last > m_first ); - } - - auto get( size_t index ) const -> T override { - // ToDo:: introduce a safe cast to catch potential overflows - return static_cast(m_first+index); - } - }; - - - template - struct NullGenerator : IGenerator { - auto get( size_t ) const -> T override { - CATCH_INTERNAL_ERROR("A Null Generator is always empty"); - } - }; - - template - class Generator { + template + class GeneratorWrapper final { std::unique_ptr> m_generator; - size_t m_size; - public: - Generator( size_t size, std::unique_ptr> generator ) - : m_generator( std::move( generator ) ), - m_size( size ) + GeneratorWrapper(std::unique_ptr> generator): + m_generator(std::move(generator)) {} - - auto size() const -> size_t { return m_size; } - auto operator[]( size_t index ) const -> T { - assert( index < m_size ); - return m_generator->get( index ); + T const& get() const { + return m_generator->get(); + } + bool next() { + return m_generator->next(); } }; - std::vector randomiseIndices( size_t selectionSize, size_t sourceSize ); + template + GeneratorWrapper value(T&& value) { + return GeneratorWrapper(pf::make_unique>(std::forward(value))); + } + template + GeneratorWrapper values(std::initializer_list values) { + return GeneratorWrapper(pf::make_unique>(values)); + } template - class GeneratorRandomiser : public IGenerator { - Generator m_baseGenerator; + class Generators : public IGenerator { + std::vector> m_generators; + size_t m_current = 0; - std::vector m_indices; - public: - GeneratorRandomiser( Generator&& baseGenerator, size_t numberOfItems ) - : m_baseGenerator( std::move( baseGenerator ) ), - m_indices( randomiseIndices( numberOfItems, m_baseGenerator.size() ) ) - {} - - auto get( size_t index ) const -> T override { - return m_baseGenerator[m_indices[index]]; + void populate(GeneratorWrapper&& generator) { + m_generators.emplace_back(std::move(generator)); } - }; - - template - struct RequiresASpecialisationFor; - - template - auto all() -> Generator { return RequiresASpecialisationFor(); } - - template<> - auto all() -> Generator; - - - template - auto range( T const& first, T const& last ) -> Generator { - return Generator( (last-first), pf::make_unique>( first, last ) ); - } - - template - auto random( T const& first, T const& last ) -> Generator { - auto gen = range( first, last ); - auto size = gen.size(); - - return Generator( size, pf::make_unique>( std::move( gen ), size ) ); - } - template - auto random( size_t size ) -> Generator { - return Generator( size, pf::make_unique>( all(), size ) ); - } - - template - auto values( std::initializer_list values ) -> Generator { - return Generator( values.size(), pf::make_unique>( values ) ); - } - template - auto value( T const& val ) -> Generator { - return Generator( 1, pf::make_unique>( val ) ); - } - - template - auto as() -> Generator { - return Generator( 0, pf::make_unique>() ); - } - - template - auto table( std::initializer_list>&& tuples ) -> Generator> { - return values>( std::forward>>( tuples ) ); - } - - - template - struct Generators : GeneratorBase { - std::vector> m_generators; - - using type = T; - - Generators() : GeneratorBase( 0 ) {} - - void populate( T&& val ) { - m_size += 1; - m_generators.emplace_back( value( std::move( val ) ) ); + void populate(T&& val) { + m_generators.emplace_back(value(std::move(val))); } template - void populate( U&& val ) { - populate( T( std::move( val ) ) ); + void populate(U&& val) { + populate(T(std::move(val))); } - void populate( Generator&& generator ) { - m_size += generator.size(); - m_generators.emplace_back( std::move( generator ) ); - } - template - void populate( U&& valueOrGenerator, Gs... moreGenerators ) { - populate( std::forward( valueOrGenerator ) ); - populate( std::forward( moreGenerators )... ); + void populate(U&& valueOrGenerator, Gs... moreGenerators) { + populate(std::forward(valueOrGenerator)); + populate(std::forward(moreGenerators)...); } - auto operator[]( size_t index ) const -> T { - size_t sizes = 0; - for( auto const& gen : m_generators ) { - auto localIndex = index-sizes; - sizes += gen.size(); - if( index < sizes ) - return gen[localIndex]; + public: + template + Generators(Gs... moreGenerators) { + m_generators.reserve(sizeof...(Gs)); + populate(std::forward(moreGenerators)...); + } + + T const& get() const override { + return m_generators[m_current].get(); + } + + bool next() override { + if (m_current >= m_generators.size()) { + return false; } - CATCH_INTERNAL_ERROR("Index '" << index << "' is out of range (" << sizes << ')'); + const bool current_status = m_generators[m_current].next(); + if (!current_status) { + ++m_current; + } + return m_current < m_generators.size(); } }; + + template + GeneratorWrapper> table( std::initializer_list::type...>> tuples ) { + return values>( tuples ); + } + + // Tag type to signal that a generator sequence should convert arguments to a specific type + template + struct as {}; + template - auto makeGenerators( Generator&& generator, Gs... moreGenerators ) -> Generators { - Generators generators; - generators.m_generators.reserve( 1+sizeof...(Gs) ); - generators.populate( std::move( generator ), std::forward( moreGenerators )... ); - return generators; + auto makeGenerators( GeneratorWrapper&& generator, Gs... moreGenerators ) -> Generators { + return Generators(std::move(generator), std::forward(moreGenerators)...); } template - auto makeGenerators( Generator&& generator ) -> Generators { - Generators generators; - generators.populate( std::move( generator ) ); - return generators; + auto makeGenerators( GeneratorWrapper&& generator ) -> Generators { + return Generators(std::move(generator)); } template auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators { return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); } template - auto makeGenerators( U&& val, Gs... moreGenerators ) -> Generators { + auto makeGenerators( as, U&& val, Gs... moreGenerators ) -> Generators { return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); } @@ -232,15 +173,16 @@ namespace Generators { // Note: The type after -> is weird, because VS2015 cannot parse // the expression used in the typedef inside, when it is in // return type. Yeah, ¯\_(ツ)_/¯ - auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval()[0]) { + auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval().get()) { using UnderlyingType = typename decltype(generatorExpression())::type; IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo ); - if( !tracker.hasGenerator() ) - tracker.setGenerator( pf::make_unique>( generatorExpression() ) ); + if (!tracker.hasGenerator()) { + tracker.setGenerator(pf::make_unique>(generatorExpression())); + } - auto const& generator = static_cast const&>( *tracker.getGenerator() ); - return generator[tracker.getIndex()]; + auto const& generator = static_cast const&>( *tracker.getGenerator() ); + return generator.get(); } } // namespace Generators diff --git a/include/internal/catch_interfaces_generatortracker.h b/include/internal/catch_interfaces_generatortracker.h index 2cf6269e..c1b1391f 100644 --- a/include/internal/catch_interfaces_generatortracker.h +++ b/include/internal/catch_interfaces_generatortracker.h @@ -13,16 +13,17 @@ namespace Catch { namespace Generators { - class GeneratorBase { - protected: - size_t m_size = 0; - + class GeneratorUntypedBase { public: - GeneratorBase( size_t size ) : m_size( size ) {} - virtual ~GeneratorBase(); - auto size() const -> size_t { return m_size; } + GeneratorUntypedBase() = default; + virtual ~GeneratorUntypedBase(); + // Attempts to move the generator to the next element + // + // Returns true iff the move succeeded (and a valid element + // can be retrieved). + virtual bool next() = 0; }; - using GeneratorBasePtr = std::unique_ptr; + using GeneratorBasePtr = std::unique_ptr; } // namespace Generators @@ -31,7 +32,6 @@ namespace Catch { virtual auto hasGenerator() const -> bool = 0; virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; - virtual auto getIndex() const -> std::size_t = 0; }; } // namespace Catch diff --git a/include/internal/catch_run_context.cpp b/include/internal/catch_run_context.cpp index ffdd2ebb..77dcaae0 100644 --- a/include/internal/catch_run_context.cpp +++ b/include/internal/catch_run_context.cpp @@ -14,7 +14,6 @@ namespace Catch { namespace Generators { struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { - size_t m_index = static_cast( -1 ); GeneratorBasePtr m_generator; GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) @@ -28,7 +27,7 @@ namespace Catch { ITracker& currentTracker = ctx.currentTracker(); if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { assert( childTracker ); - assert( childTracker->isIndexTracker() ); + assert( childTracker->isGeneratorTracker() ); tracker = std::static_pointer_cast( childTracker ); } else { @@ -37,28 +36,24 @@ namespace Catch { } if( !ctx.completedCycle() && !tracker->isComplete() ) { - if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) - tracker->moveNext(); tracker->open(); } return *tracker; } - void moveNext() { - m_index++; - m_children.clear(); - } - // TrackerBase interface - bool isIndexTracker() const override { return true; } + bool isGeneratorTracker() const override { return true; } auto hasGenerator() const -> bool override { return !!m_generator; } void close() override { TrackerBase::close(); - if( m_runState == CompletedSuccessfully && m_index < m_generator->size()-1 ) + // Generator interface only finds out if it has another item on atual move + if (m_runState == CompletedSuccessfully && m_generator->next()) { + m_children.clear(); m_runState = Executing; + } } // IGeneratorTracker interface @@ -68,9 +63,6 @@ namespace Catch { void setGenerator( GeneratorBasePtr&& generator ) override { m_generator = std::move( generator ); } - auto getIndex() const -> size_t override { - return m_index; - } }; GeneratorTracker::~GeneratorTracker() {} } diff --git a/include/internal/catch_test_case_tracker.cpp b/include/internal/catch_test_case_tracker.cpp index f6e5ac08..210f2730 100644 --- a/include/internal/catch_test_case_tracker.cpp +++ b/include/internal/catch_test_case_tracker.cpp @@ -121,7 +121,7 @@ namespace TestCaseTracking { } bool TrackerBase::isSectionTracker() const { return false; } - bool TrackerBase::isIndexTracker() const { return false; } + bool TrackerBase::isGeneratorTracker() const { return false; } void TrackerBase::open() { m_runState = Executing; diff --git a/include/internal/catch_test_case_tracker.h b/include/internal/catch_test_case_tracker.h index e873d788..17276001 100644 --- a/include/internal/catch_test_case_tracker.h +++ b/include/internal/catch_test_case_tracker.h @@ -54,7 +54,7 @@ namespace TestCaseTracking { // Debug/ checking virtual bool isSectionTracker() const = 0; - virtual bool isIndexTracker() const = 0; + virtual bool isGeneratorTracker() const = 0; }; class TrackerContext { @@ -120,7 +120,7 @@ namespace TestCaseTracking { void openChild() override; bool isSectionTracker() const override; - bool isIndexTracker() const override; + bool isGeneratorTracker() const override; void open(); diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 72627f1f..174adc48 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -57,106 +57,87 @@ Tricky.tests.cpp:: passed: !is_true::value for: true Tricky.tests.cpp:: passed: !!is_true::value for: true Tricky.tests.cpp:: passed: is_true::value for: true Tricky.tests.cpp:: passed: !(is_true::value) for: !false -Generators.tests.cpp:: passed: x < y for: 1 < 101 -Generators.tests.cpp:: passed: x < y for: 1 < 102 -Generators.tests.cpp:: passed: x < y for: 1 < 103 -Generators.tests.cpp:: passed: x < y for: 1 < 104 -Generators.tests.cpp:: passed: x < y for: 1 < 105 -Generators.tests.cpp:: passed: x < y for: 1 < 106 -Generators.tests.cpp:: passed: x < y for: 1 < 107 -Generators.tests.cpp:: passed: x < y for: 1 < 108 -Generators.tests.cpp:: passed: x < y for: 1 < 109 -Generators.tests.cpp:: passed: x < y for: 1 < 110 -Generators.tests.cpp:: passed: x < y for: 2 < 101 -Generators.tests.cpp:: passed: x < y for: 2 < 102 -Generators.tests.cpp:: passed: x < y for: 2 < 103 -Generators.tests.cpp:: passed: x < y for: 2 < 104 -Generators.tests.cpp:: passed: x < y for: 2 < 105 -Generators.tests.cpp:: passed: x < y for: 2 < 106 -Generators.tests.cpp:: passed: x < y for: 2 < 107 -Generators.tests.cpp:: passed: x < y for: 2 < 108 -Generators.tests.cpp:: passed: x < y for: 2 < 109 -Generators.tests.cpp:: passed: x < y for: 2 < 110 -Generators.tests.cpp:: passed: x < y for: 3 < 101 -Generators.tests.cpp:: passed: x < y for: 3 < 102 -Generators.tests.cpp:: passed: x < y for: 3 < 103 -Generators.tests.cpp:: passed: x < y for: 3 < 104 -Generators.tests.cpp:: passed: x < y for: 3 < 105 -Generators.tests.cpp:: passed: x < y for: 3 < 106 -Generators.tests.cpp:: passed: x < y for: 3 < 107 -Generators.tests.cpp:: passed: x < y for: 3 < 108 -Generators.tests.cpp:: passed: x < y for: 3 < 109 -Generators.tests.cpp:: passed: x < y for: 3 < 110 -Generators.tests.cpp:: passed: x < y for: 4 < 101 -Generators.tests.cpp:: passed: x < y for: 4 < 102 -Generators.tests.cpp:: passed: x < y for: 4 < 103 -Generators.tests.cpp:: passed: x < y for: 4 < 104 -Generators.tests.cpp:: passed: x < y for: 4 < 105 -Generators.tests.cpp:: passed: x < y for: 4 < 106 -Generators.tests.cpp:: passed: x < y for: 4 < 107 -Generators.tests.cpp:: passed: x < y for: 4 < 108 -Generators.tests.cpp:: passed: x < y for: 4 < 109 -Generators.tests.cpp:: passed: x < y for: 4 < 110 -Generators.tests.cpp:: passed: x < y for: 5 < 101 -Generators.tests.cpp:: passed: x < y for: 5 < 102 -Generators.tests.cpp:: passed: x < y for: 5 < 103 -Generators.tests.cpp:: passed: x < y for: 5 < 104 -Generators.tests.cpp:: passed: x < y for: 5 < 105 -Generators.tests.cpp:: passed: x < y for: 5 < 106 -Generators.tests.cpp:: passed: x < y for: 5 < 107 -Generators.tests.cpp:: passed: x < y for: 5 < 108 -Generators.tests.cpp:: passed: x < y for: 5 < 109 -Generators.tests.cpp:: passed: x < y for: 5 < 110 -Generators.tests.cpp:: passed: x < y for: 6 < 101 -Generators.tests.cpp:: passed: x < y for: 6 < 102 -Generators.tests.cpp:: passed: x < y for: 6 < 103 -Generators.tests.cpp:: passed: x < y for: 6 < 104 -Generators.tests.cpp:: passed: x < y for: 6 < 105 -Generators.tests.cpp:: passed: x < y for: 6 < 106 -Generators.tests.cpp:: passed: x < y for: 6 < 107 -Generators.tests.cpp:: passed: x < y for: 6 < 108 -Generators.tests.cpp:: passed: x < y for: 6 < 109 -Generators.tests.cpp:: passed: x < y for: 6 < 110 -Generators.tests.cpp:: passed: x < y for: 7 < 101 -Generators.tests.cpp:: passed: x < y for: 7 < 102 -Generators.tests.cpp:: passed: x < y for: 7 < 103 -Generators.tests.cpp:: passed: x < y for: 7 < 104 -Generators.tests.cpp:: passed: x < y for: 7 < 105 -Generators.tests.cpp:: passed: x < y for: 7 < 106 -Generators.tests.cpp:: passed: x < y for: 7 < 107 -Generators.tests.cpp:: passed: x < y for: 7 < 108 -Generators.tests.cpp:: passed: x < y for: 7 < 109 -Generators.tests.cpp:: passed: x < y for: 7 < 110 -Generators.tests.cpp:: passed: x < y for: 8 < 101 -Generators.tests.cpp:: passed: x < y for: 8 < 102 -Generators.tests.cpp:: passed: x < y for: 8 < 103 -Generators.tests.cpp:: passed: x < y for: 8 < 104 -Generators.tests.cpp:: passed: x < y for: 8 < 105 -Generators.tests.cpp:: passed: x < y for: 8 < 106 -Generators.tests.cpp:: passed: x < y for: 8 < 107 -Generators.tests.cpp:: passed: x < y for: 8 < 108 -Generators.tests.cpp:: passed: x < y for: 8 < 109 -Generators.tests.cpp:: passed: x < y for: 8 < 110 -Generators.tests.cpp:: passed: x < y for: 9 < 101 -Generators.tests.cpp:: passed: x < y for: 9 < 102 -Generators.tests.cpp:: passed: x < y for: 9 < 103 -Generators.tests.cpp:: passed: x < y for: 9 < 104 -Generators.tests.cpp:: passed: x < y for: 9 < 105 -Generators.tests.cpp:: passed: x < y for: 9 < 106 -Generators.tests.cpp:: passed: x < y for: 9 < 107 -Generators.tests.cpp:: passed: x < y for: 9 < 108 -Generators.tests.cpp:: passed: x < y for: 9 < 109 -Generators.tests.cpp:: passed: x < y for: 9 < 110 -Generators.tests.cpp:: passed: x < y for: 10 < 101 -Generators.tests.cpp:: passed: x < y for: 10 < 102 -Generators.tests.cpp:: passed: x < y for: 10 < 103 -Generators.tests.cpp:: passed: x < y for: 10 < 104 -Generators.tests.cpp:: passed: x < y for: 10 < 105 -Generators.tests.cpp:: passed: x < y for: 10 < 106 -Generators.tests.cpp:: passed: x < y for: 10 < 107 -Generators.tests.cpp:: passed: x < y for: 10 < 108 -Generators.tests.cpp:: passed: x < y for: 10 < 109 -Generators.tests.cpp:: passed: x < y for: 10 < 110 +Generators.tests.cpp:: passed: x < y for: 1 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 7 +Generators.tests.cpp:: passed: x < z for: 1 < 7 +Generators.tests.cpp:: passed: x < y for: 1 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 8 +Generators.tests.cpp:: passed: x < z for: 1 < 8 +Generators.tests.cpp:: passed: x < y for: 1 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 9 +Generators.tests.cpp:: passed: x < z for: 1 < 9 +Generators.tests.cpp:: passed: x < y for: 1 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 7 +Generators.tests.cpp:: passed: x < z for: 1 < 7 +Generators.tests.cpp:: passed: x < y for: 1 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 8 +Generators.tests.cpp:: passed: x < z for: 1 < 8 +Generators.tests.cpp:: passed: x < y for: 1 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 9 +Generators.tests.cpp:: passed: x < z for: 1 < 9 +Generators.tests.cpp:: passed: x < y for: 1 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 7 +Generators.tests.cpp:: passed: x < z for: 1 < 7 +Generators.tests.cpp:: passed: x < y for: 1 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 8 +Generators.tests.cpp:: passed: x < z for: 1 < 8 +Generators.tests.cpp:: passed: x < y for: 1 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 9 +Generators.tests.cpp:: passed: x < z for: 1 < 9 +Generators.tests.cpp:: passed: x < y for: 2 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 7 +Generators.tests.cpp:: passed: x < z for: 2 < 7 +Generators.tests.cpp:: passed: x < y for: 2 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 8 +Generators.tests.cpp:: passed: x < z for: 2 < 8 +Generators.tests.cpp:: passed: x < y for: 2 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 9 +Generators.tests.cpp:: passed: x < z for: 2 < 9 +Generators.tests.cpp:: passed: x < y for: 2 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 7 +Generators.tests.cpp:: passed: x < z for: 2 < 7 +Generators.tests.cpp:: passed: x < y for: 2 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 8 +Generators.tests.cpp:: passed: x < z for: 2 < 8 +Generators.tests.cpp:: passed: x < y for: 2 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 9 +Generators.tests.cpp:: passed: x < z for: 2 < 9 +Generators.tests.cpp:: passed: x < y for: 2 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 7 +Generators.tests.cpp:: passed: x < z for: 2 < 7 +Generators.tests.cpp:: passed: x < y for: 2 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 8 +Generators.tests.cpp:: passed: x < z for: 2 < 8 +Generators.tests.cpp:: passed: x < y for: 2 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 9 +Generators.tests.cpp:: passed: x < z for: 2 < 9 +Generators.tests.cpp:: passed: x < y for: 3 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 7 +Generators.tests.cpp:: passed: x < z for: 3 < 7 +Generators.tests.cpp:: passed: x < y for: 3 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 8 +Generators.tests.cpp:: passed: x < z for: 3 < 8 +Generators.tests.cpp:: passed: x < y for: 3 < 4 +Generators.tests.cpp:: passed: y < z for: 4 < 9 +Generators.tests.cpp:: passed: x < z for: 3 < 9 +Generators.tests.cpp:: passed: x < y for: 3 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 7 +Generators.tests.cpp:: passed: x < z for: 3 < 7 +Generators.tests.cpp:: passed: x < y for: 3 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 8 +Generators.tests.cpp:: passed: x < z for: 3 < 8 +Generators.tests.cpp:: passed: x < y for: 3 < 5 +Generators.tests.cpp:: passed: y < z for: 5 < 9 +Generators.tests.cpp:: passed: x < z for: 3 < 9 +Generators.tests.cpp:: passed: x < y for: 3 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 7 +Generators.tests.cpp:: passed: x < z for: 3 < 7 +Generators.tests.cpp:: passed: x < y for: 3 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 8 +Generators.tests.cpp:: passed: x < z for: 3 < 8 +Generators.tests.cpp:: passed: x < y for: 3 < 6 +Generators.tests.cpp:: passed: y < z for: 6 < 9 +Generators.tests.cpp:: passed: x < z for: 3 < 9 Class.tests.cpp:: failed: s == "world" for: "hello" == "world" Class.tests.cpp:: passed: s == "hello" for: "hello" == "hello" Class.tests.cpp:: failed: Template_Fixture_2::m_a.size() == 1 for: 0 == 1 @@ -418,48 +399,49 @@ Matchers.tests.cpp:: passed: WithinAbs(1.f, 0.f) Matchers.tests.cpp:: passed: WithinAbs(1.f, -1.f), std::domain_error Matchers.tests.cpp:: passed: WithinULP(1.f, 0) Matchers.tests.cpp:: passed: WithinULP(1.f, -1), std::domain_error -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 8' -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 9' -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 10' -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 2' -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 3.141' -Generators.tests.cpp:: passed: with 2 messages: 'i := "a"' and 'j := 1.379' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 8' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 9' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 10' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 2' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 3.141' -Generators.tests.cpp:: passed: with 2 messages: 'i := "b"' and 'j := 1.379' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 8' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 9' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 10' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 2' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 3.141' -Generators.tests.cpp:: passed: with 2 messages: 'i := "c"' and 'j := 1.379' -GeneratorsImpl.tests.cpp:: passed: gen.size() == 2 for: 2 == 2 -GeneratorsImpl.tests.cpp:: passed: gen[0] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: gen[1] == 2 for: 2 == 2 -GeneratorsImpl.tests.cpp:: passed: gen.size() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:: passed: gen[0] == 3 for: 3 == 3 -GeneratorsImpl.tests.cpp:: passed: gen[1] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: gen[2] == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:: passed: gen[3] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: gen.size() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:: passed: gen[0] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: gen[1] == 2 for: 2 == 2 -GeneratorsImpl.tests.cpp:: passed: gen[2] == 9 for: 9 == 9 -GeneratorsImpl.tests.cpp:: passed: gen[3] == 7 for: 7 == 7 -GeneratorsImpl.tests.cpp:: passed: gen.size() == 2 for: 2 == 2 -GeneratorsImpl.tests.cpp:: passed: gen[0] == 3 for: 3 == 3 -GeneratorsImpl.tests.cpp:: passed: gen[1] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: gen.size() == 2 for: 2 == 2 -GeneratorsImpl.tests.cpp:: passed: gen[0] == 3 for: 3 == 3 -GeneratorsImpl.tests.cpp:: passed: gen[1] == 1 for: 1 == 1 -GeneratorsImpl.tests.cpp:: passed: base->size() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:: passed: typed for: 0x -GeneratorsImpl.tests.cpp:: passed: typed->size() == 4 for: 4 == 4 -GeneratorsImpl.tests.cpp:: passed: (*typed)[0] == 7 for: 7 == 7 -GeneratorsImpl.tests.cpp:: passed: (*typed)[3] == 11 for: 11 == 11 +Generators.tests.cpp:: passed: j < i for: -3 < 1 +Generators.tests.cpp:: passed: j < i for: -2 < 1 +Generators.tests.cpp:: passed: j < i for: -1 < 1 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 4 > 1 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 4 > 2 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 4 > 3 +Generators.tests.cpp:: passed: j < i for: -3 < 2 +Generators.tests.cpp:: passed: j < i for: -2 < 2 +Generators.tests.cpp:: passed: j < i for: -1 < 2 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 8 > 1 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 8 > 2 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 8 > 3 +Generators.tests.cpp:: passed: j < i for: -3 < 3 +Generators.tests.cpp:: passed: j < i for: -2 < 3 +Generators.tests.cpp:: passed: j < i for: -1 < 3 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 12 > 1 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 12 > 2 +Generators.tests.cpp:: passed: 4u * i > str.size() for: 12 > 3 +GeneratorsImpl.tests.cpp:: passed: gen.get() == 123 for: 123 == 123 +GeneratorsImpl.tests.cpp:: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 3 for: 3 == 3 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:: passed: gen.get() == 1 for: 1 == 1 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 5 for: 5 == 5 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 4 for: 4 == 4 +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == 0 for: 0 == 0 +GeneratorsImpl.tests.cpp:: passed: !(gen.next()) for: !false +GeneratorsImpl.tests.cpp:: passed: gen.get().size() == 2 for: 2 == 2 +GeneratorsImpl.tests.cpp:: passed: gen.get() == "aa" for: "aa" == "aa" +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == "bb" for: "bb" == "bb" +GeneratorsImpl.tests.cpp:: passed: gen.next() for: true +GeneratorsImpl.tests.cpp:: passed: gen.get() == "cc" for: "cc" == "cc" +GeneratorsImpl.tests.cpp:: passed: !(gen.next()) for: !false Approx.tests.cpp:: passed: d >= Approx( 1.22 ) for: 1.23 >= Approx( 1.22 ) Approx.tests.cpp:: passed: d >= Approx( 1.23 ) for: 1.23 >= Approx( 1.23 ) Approx.tests.cpp:: passed: !(d >= Approx( 1.24 )) for: !(1.23 >= Approx( 1.24 )) @@ -1274,6 +1256,10 @@ Generators.tests.cpp:: passed: data.str.size() == data.len for: 3 = Generators.tests.cpp:: passed: data.str.size() == data.len for: 3 == 3 Generators.tests.cpp:: passed: data.str.size() == data.len for: 5 == 5 Generators.tests.cpp:: passed: data.str.size() == data.len for: 4 == 4 +Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 5 == 5 +Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 6 == 6 +Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 5 == 5 +Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 6 == 6 Exception.tests.cpp:: failed: unexpected exception with message: 'Why would you throw a std::string?' Misc.tests.cpp:: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" Misc.tests.cpp:: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index dff912cf..750596b8 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1170,6 +1170,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 243 | 183 passed | 56 failed | 4 failed as expected -assertions: 1262 | 1126 passed | 115 failed | 21 failed as expected +test cases: 244 | 184 passed | 56 failed | 4 failed as expected +assertions: 1248 | 1112 passed | 115 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 79334630..bb06d688 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -456,7 +456,7 @@ with expansion: !false ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -464,32 +464,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 1 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 1 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 1 < 103 + 1 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -497,32 +485,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 1 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 1 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 1 < 106 + 1 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -530,32 +506,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 1 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 1 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 1 < 109 + 1 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -563,32 +527,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 1 < 110 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 2 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 2 < 102 + 1 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -596,32 +548,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 2 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 2 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 2 < 105 + 1 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -629,32 +569,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 2 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 2 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 2 < 108 + 1 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -662,32 +590,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 2 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 2 < 110 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 3 < 101 + 1 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -695,32 +611,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 3 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 3 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 3 < 104 + 1 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -728,32 +632,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 3 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 1 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 3 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 3 < 107 + 1 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -761,32 +653,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 3 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 3 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 3 < 110 + 2 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -794,32 +674,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 4 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 4 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 4 < 103 + 2 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -827,32 +695,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 4 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 4 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 4 < 106 + 2 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -860,32 +716,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 4 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 4 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 4 < 109 + 2 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -893,32 +737,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 4 < 110 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 5 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 5 < 102 + 2 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -926,32 +758,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 5 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 5 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 5 < 105 + 2 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -959,32 +779,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 5 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 5 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 5 < 108 + 2 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -992,32 +800,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 5 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 5 < 110 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 6 < 101 + 2 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1025,32 +821,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 6 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 2 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 6 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 6 < 104 + 2 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1058,32 +842,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 6 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 6 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 6 < 107 + 3 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1091,32 +863,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 6 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 6 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 6 < 110 + 3 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1124,76 +884,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 7 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 4 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 7 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 7 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 7 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 7 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 7 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 4 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 7 < 107 + 3 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1201,32 +905,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 7 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 7 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 7 < 110 + 3 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1234,43 +926,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 8 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 8 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 8 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 8 < 104 + 3 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1278,32 +947,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 8 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 5 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 8 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 5 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 8 < 107 + 3 < 9 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1311,32 +968,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 8 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 8 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 7 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 8 < 110 + 3 < 7 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1344,32 +989,20 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 9 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 9 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 8 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 9 < 103 + 3 < 8 ------------------------------------------------------------------------------- -10x10 ints +3x3x3 ints ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... @@ -1377,183 +1010,17 @@ Generators.tests.cpp: Generators.tests.cpp:: PASSED: CHECK( x < y ) with expansion: - 9 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 3 < 6 Generators.tests.cpp:: PASSED: - CHECK( x < y ) + CHECK( y < z ) with expansion: - 9 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... + 6 < 9 Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 9 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 9 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 9 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 9 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 9 < 110 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 101 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 102 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 103 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 104 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 105 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 106 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 107 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 108 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) -with expansion: - 10 < 109 - -------------------------------------------------------------------------------- -10x10 ints -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: - CHECK( x < y ) + REQUIRE( x < z ) with expansion: - 10 < 110 + 3 < 9 ------------------------------------------------------------------------------- A METHOD_AS_TEST_CASE based test run that fails @@ -3384,382 +2851,373 @@ Matchers.tests.cpp:: PASSED: REQUIRE_THROWS_AS( WithinULP(1.f, -1), std::domain_error ) ------------------------------------------------------------------------------- -Generators +Generators -- simple one ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 8 + REQUIRE( j < i ) +with expansion: + -3 < 1 ------------------------------------------------------------------------------- -Generators +Generators -- simple one ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 9 + REQUIRE( j < i ) +with expansion: + -2 < 1 ------------------------------------------------------------------------------- -Generators +Generators -- simple one ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 10 + REQUIRE( j < i ) +with expansion: + -1 < 1 ------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 2 - -------------------------------------------------------------------------------- -Generators +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 3.141 + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 1 ------------------------------------------------------------------------------- -Generators +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "a" - j := 1.379 + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 2 ------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 8 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 9 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 10 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 2 - -------------------------------------------------------------------------------- -Generators +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 3.141 + REQUIRE( 4u * i > str.size() ) +with expansion: + 4 > 3 ------------------------------------------------------------------------------- -Generators +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -3 < 2 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -2 < 2 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -1 < 2 + +------------------------------------------------------------------------------- +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "b" - j := 1.379 + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 1 ------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 8 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 9 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 10 - -------------------------------------------------------------------------------- -Generators - one -------------------------------------------------------------------------------- -Generators.tests.cpp: -............................................................................... - -Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 2 - -------------------------------------------------------------------------------- -Generators +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 3.141 + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 2 ------------------------------------------------------------------------------- -Generators +Generators -- simple two ------------------------------------------------------------------------------- Generators.tests.cpp: ............................................................................... Generators.tests.cpp:: PASSED: -with messages: - i := "c" - j := 1.379 + REQUIRE( 4u * i > str.size() ) +with expansion: + 8 > 3 ------------------------------------------------------------------------------- -Generators impl - range +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -3 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -2 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + one +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( j < i ) +with expansion: + -1 < 3 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 1 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 2 + +------------------------------------------------------------------------------- +Generators -- simple + two +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( 4u * i > str.size() ) +with expansion: + 12 > 3 + +------------------------------------------------------------------------------- +Generators internals + Single value ------------------------------------------------------------------------------- GeneratorsImpl.tests.cpp: ............................................................................... GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen.size() == 2 ) + REQUIRE( gen.get() == 123 ) with expansion: - 2 == 2 + 123 == 123 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[0] == 1 ) + REQUIRE_FALSE( gen.next() ) +with expansion: + !false + +------------------------------------------------------------------------------- +Generators internals + Preset values +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp: +............................................................................... + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == 1 ) with expansion: 1 == 1 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[1] == 2 ) + REQUIRE( gen.next() ) with expansion: - 2 == 2 - -------------------------------------------------------------------------------- -Generators impl - fixed values -------------------------------------------------------------------------------- -GeneratorsImpl.tests.cpp: -............................................................................... + true GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen.size() == 4 ) -with expansion: - 4 == 4 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[0] == 3 ) + REQUIRE( gen.get() == 3 ) with expansion: 3 == 3 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[1] == 1 ) + REQUIRE( gen.next() ) with expansion: - 1 == 1 + true GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[2] == 4 ) + REQUIRE( gen.get() == 5 ) with expansion: - 4 == 4 + 5 == 5 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[3] == 1 ) + REQUIRE_FALSE( gen.next() ) with expansion: - 1 == 1 + !false ------------------------------------------------------------------------------- -Generators impl - combined +Generators internals + Generator combinator ------------------------------------------------------------------------------- GeneratorsImpl.tests.cpp: ............................................................................... GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen.size() == 4 ) -with expansion: - 4 == 4 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[0] == 1 ) + REQUIRE( gen.get() == 1 ) with expansion: 1 == 1 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[1] == 2 ) + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == 5 ) +with expansion: + 5 == 5 + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == 2 ) with expansion: 2 == 2 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[2] == 9 ) + REQUIRE( gen.next() ) with expansion: - 9 == 9 + true GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[3] == 7 ) -with expansion: - 7 == 7 - -------------------------------------------------------------------------------- -Generators impl - values -------------------------------------------------------------------------------- -GeneratorsImpl.tests.cpp: -............................................................................... - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen.size() == 2 ) -with expansion: - 2 == 2 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[0] == 3 ) -with expansion: - 3 == 3 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[1] == 1 ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Generators impl - values2 -------------------------------------------------------------------------------- -GeneratorsImpl.tests.cpp: -............................................................................... - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen.size() == 2 ) -with expansion: - 2 == 2 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[0] == 3 ) -with expansion: - 3 == 3 - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( gen[1] == 1 ) -with expansion: - 1 == 1 - -------------------------------------------------------------------------------- -Generators impl - type erasure -------------------------------------------------------------------------------- -GeneratorsImpl.tests.cpp: -............................................................................... - -GeneratorsImpl.tests.cpp:: PASSED: - CHECK( base->size() == 4 ) + REQUIRE( gen.get() == 4 ) with expansion: 4 == 4 GeneratorsImpl.tests.cpp:: PASSED: - REQUIRE( typed ) + REQUIRE( gen.next() ) with expansion: - 0x + true GeneratorsImpl.tests.cpp:: PASSED: - CHECK( typed->size() == 4 ) + REQUIRE( gen.get() == 0 ) with expansion: - 4 == 4 + 0 == 0 GeneratorsImpl.tests.cpp:: PASSED: - CHECK( (*typed)[0] == 7 ) + REQUIRE_FALSE( gen.next() ) with expansion: - 7 == 7 + !false + +------------------------------------------------------------------------------- +Generators internals + Explicitly typed generator sequence +------------------------------------------------------------------------------- +GeneratorsImpl.tests.cpp: +............................................................................... GeneratorsImpl.tests.cpp:: PASSED: - CHECK( (*typed)[3] == 11 ) + REQUIRE( gen.get().size() == 2 ) with expansion: - 11 == 11 + 2 == 2 + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == "aa" ) +with expansion: + "aa" == "aa" + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == "bb" ) +with expansion: + "bb" == "bb" + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.next() ) +with expansion: + true + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE( gen.get() == "cc" ) +with expansion: + "cc" == "cc" + +GeneratorsImpl.tests.cpp:: PASSED: + REQUIRE_FALSE( gen.next() ) +with expansion: + !false ------------------------------------------------------------------------------- Greater-than inequalities with different epsilons @@ -9747,6 +9205,50 @@ Generators.tests.cpp:: PASSED: with expansion: 4 == 4 +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) ) +with expansion: + 5 == 5 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) ) +with expansion: + 6 == 6 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) ) +with expansion: + 5 == 5 + +------------------------------------------------------------------------------- +tables +------------------------------------------------------------------------------- +Generators.tests.cpp: +............................................................................... + +Generators.tests.cpp:: PASSED: + REQUIRE( strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) ) +with expansion: + 6 == 6 + ------------------------------------------------------------------------------- thrown std::strings are translated ------------------------------------------------------------------------------- @@ -10224,6 +9726,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 243 | 170 passed | 69 failed | 4 failed as expected -assertions: 1276 | 1126 passed | 129 failed | 21 failed as expected +test cases: 244 | 171 passed | 69 failed | 4 failed as expected +assertions: 1262 | 1112 passed | 129 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 17cc8281..3e23fdbd 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -70,7 +70,7 @@ Condition.tests.cpp: - + Class.tests.cpp: @@ -339,14 +339,12 @@ Message.tests.cpp: - - - - - - - - + + + + + + @@ -938,6 +936,7 @@ Tricky.tests.cpp: + Why would you throw a std::string? diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 497d8168..6375db17 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -522,157 +522,29 @@ - + x < y - 1 < 101 + 1 < 4 - x < y - - - 1 < 102 - - - - - x < y - - - 1 < 103 - - - - - x < y - - - 1 < 104 - - - - - x < y - - - 1 < 105 - - - - - x < y - - - 1 < 106 - - - - - x < y - - - 1 < 107 - - - - - x < y - - - 1 < 108 - - - - - x < y - - - 1 < 109 - - - - - x < y - - - 1 < 110 - - - - - x < y - - - 2 < 101 - - - - - x < y - - - 2 < 102 - - - - - x < y - - - 2 < 103 - - - - - x < y - - - 2 < 104 - - - - - x < y - - - 2 < 105 - - - - - x < y - - - 2 < 106 - - - - - x < y - - - 2 < 107 - - - - - x < y + y < z - 2 < 108 + 4 < 7 - + - x < y + x < z - 2 < 109 + 1 < 7 @@ -680,23 +552,23 @@ x < y - 2 < 110 + 1 < 4 - x < y + y < z - 3 < 101 + 4 < 8 - + - x < y + x < z - 3 < 102 + 1 < 8 @@ -704,23 +576,23 @@ x < y - 3 < 103 + 1 < 4 - x < y + y < z - 3 < 104 + 4 < 9 - + - x < y + x < z - 3 < 105 + 1 < 9 @@ -728,23 +600,23 @@ x < y - 3 < 106 + 1 < 5 - x < y + y < z - 3 < 107 + 5 < 7 - + - x < y + x < z - 3 < 108 + 1 < 7 @@ -752,23 +624,23 @@ x < y - 3 < 109 + 1 < 5 - x < y + y < z - 3 < 110 + 5 < 8 - + - x < y + x < z - 4 < 101 + 1 < 8 @@ -776,23 +648,23 @@ x < y - 4 < 102 + 1 < 5 - x < y + y < z - 4 < 103 + 5 < 9 - + - x < y + x < z - 4 < 104 + 1 < 9 @@ -800,23 +672,23 @@ x < y - 4 < 105 + 1 < 6 - x < y + y < z - 4 < 106 + 6 < 7 - + - x < y + x < z - 4 < 107 + 1 < 7 @@ -824,23 +696,23 @@ x < y - 4 < 108 + 1 < 6 - x < y + y < z - 4 < 109 + 6 < 8 - + - x < y + x < z - 4 < 110 + 1 < 8 @@ -848,23 +720,23 @@ x < y - 5 < 101 + 1 < 6 - x < y + y < z - 5 < 102 + 6 < 9 - + - x < y + x < z - 5 < 103 + 1 < 9 @@ -872,23 +744,23 @@ x < y - 5 < 104 + 2 < 4 - x < y + y < z - 5 < 105 + 4 < 7 - + - x < y + x < z - 5 < 106 + 2 < 7 @@ -896,23 +768,23 @@ x < y - 5 < 107 + 2 < 4 - x < y + y < z - 5 < 108 + 4 < 8 - + - x < y + x < z - 5 < 109 + 2 < 8 @@ -920,23 +792,23 @@ x < y - 5 < 110 + 2 < 4 - x < y + y < z - 6 < 101 + 4 < 9 - + - x < y + x < z - 6 < 102 + 2 < 9 @@ -944,23 +816,23 @@ x < y - 6 < 103 + 2 < 5 - x < y + y < z - 6 < 104 + 5 < 7 - + - x < y + x < z - 6 < 105 + 2 < 7 @@ -968,23 +840,23 @@ x < y - 6 < 106 + 2 < 5 - x < y + y < z - 6 < 107 + 5 < 8 - + - x < y + x < z - 6 < 108 + 2 < 8 @@ -992,23 +864,23 @@ x < y - 6 < 109 + 2 < 5 - x < y + y < z - 6 < 110 + 5 < 9 - + - x < y + x < z - 7 < 101 + 2 < 9 @@ -1016,23 +888,23 @@ x < y - 7 < 102 + 2 < 6 - x < y + y < z - 7 < 103 + 6 < 7 - + - x < y + x < z - 7 < 104 + 2 < 7 @@ -1040,23 +912,23 @@ x < y - 7 < 105 + 2 < 6 - x < y + y < z - 7 < 106 + 6 < 8 - + - x < y + x < z - 7 < 107 + 2 < 8 @@ -1064,23 +936,23 @@ x < y - 7 < 108 + 2 < 6 - x < y + y < z - 7 < 109 + 6 < 9 - + - x < y + x < z - 7 < 110 + 2 < 9 @@ -1088,23 +960,23 @@ x < y - 8 < 101 + 3 < 4 - x < y + y < z - 8 < 102 + 4 < 7 - + - x < y + x < z - 8 < 103 + 3 < 7 @@ -1112,23 +984,23 @@ x < y - 8 < 104 + 3 < 4 - x < y + y < z - 8 < 105 + 4 < 8 - + - x < y + x < z - 8 < 106 + 3 < 8 @@ -1136,23 +1008,23 @@ x < y - 8 < 107 + 3 < 4 - x < y + y < z - 8 < 108 + 4 < 9 - + - x < y + x < z - 8 < 109 + 3 < 9 @@ -1160,23 +1032,23 @@ x < y - 8 < 110 + 3 < 5 - x < y + y < z - 9 < 101 + 5 < 7 - + - x < y + x < z - 9 < 102 + 3 < 7 @@ -1184,23 +1056,23 @@ x < y - 9 < 103 + 3 < 5 - x < y + y < z - 9 < 104 + 5 < 8 - + - x < y + x < z - 9 < 105 + 3 < 8 @@ -1208,23 +1080,23 @@ x < y - 9 < 106 + 3 < 5 - x < y + y < z - 9 < 107 + 5 < 9 - + - x < y + x < z - 9 < 108 + 3 < 9 @@ -1232,23 +1104,23 @@ x < y - 9 < 109 + 3 < 6 - x < y + y < z - 9 < 110 + 6 < 7 - + - x < y + x < z - 10 < 101 + 3 < 7 @@ -1256,39 +1128,23 @@ x < y - 10 < 102 + 3 < 6 - x < y + y < z - 10 < 103 + 6 < 8 - - - x < y - - - 10 < 104 - - - - - x < y - - - 10 < 105 - - - + - x < y + x < z - 10 < 106 + 3 < 8 @@ -1296,31 +1152,23 @@ x < y - 10 < 107 + 3 < 6 - x < y + y < z - 10 < 108 + 6 < 9 - + - x < y - - - 10 < 109 - - - - - x < y + x < z - 10 < 110 + 3 < 9 @@ -3690,343 +3538,330 @@ - +
- - i := "a" - - - j := 8 - + + + j < i + + + -3 < 1 + +
- - i := "a" - - - j := 9 - + + + j < i + + + -2 < 1 + +
- - i := "a" - - - j := 10 - - -
-
- - i := "a" - - - j := 2 - + + + j < i + + + -1 < 1 + +
- - i := "a" - - - j := 3.141 - + + + 4u * i > str.size() + + + 4 > 1 + +
- - i := "a" - - - j := 1.379 - - -
-
- - i := "b" - - - j := 8 - - -
-
- - i := "b" - - - j := 9 - - -
-
- - i := "b" - - - j := 10 - - -
-
- - i := "b" - - - j := 2 - + + + 4u * i > str.size() + + + 4 > 2 + +
- - i := "b" - - - j := 3.141 - + + + 4u * i > str.size() + + + 4 > 3 + + + +
+
+ + + j < i + + + -3 < 2 + + + +
+
+ + + j < i + + + -2 < 2 + + + +
+
+ + + j < i + + + -1 < 2 + +
- - i := "b" - - - j := 1.379 - - -
-
- - i := "c" - - - j := 8 - - -
-
- - i := "c" - - - j := 9 - - -
-
- - i := "c" - - - j := 10 - - -
-
- - i := "c" - - - j := 2 - + + + 4u * i > str.size() + + + 8 > 1 + +
- - i := "c" - - - j := 3.141 - + + + 4u * i > str.size() + + + 8 > 2 + +
- - i := "c" - - - j := 1.379 - + + + 4u * i > str.size() + + + 8 > 3 + + + +
+
+ + + j < i + + + -3 < 3 + + + +
+
+ + + j < i + + + -2 < 3 + + + +
+
+ + + j < i + + + -1 < 3 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 1 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 2 + + + +
+
+ + + 4u * i > str.size() + + + 12 > 3 + +
- -
- + +
+ - gen.size() == 2 + gen.get() == 123 - 2 == 2 + 123 == 123 - + - gen[0] == 1 + !(gen.next()) + + + !false + + + +
+
+ + + gen.get() == 1 1 == 1 - + - gen[1] == 2 + gen.next() - 2 == 2 + true - -
-
- + - gen.size() == 4 - - - 4 == 4 - - - - - gen[0] == 3 + gen.get() == 3 3 == 3 - + - gen[1] == 1 + gen.next() - 1 == 1 + true - + - gen[2] == 4 + gen.get() == 5 - 4 == 4 + 5 == 5 - + - gen[3] == 1 + !(gen.next()) - 1 == 1 + !false - +
-
- +
+ - gen.size() == 4 - - - 4 == 4 - - - - - gen[0] == 1 + gen.get() == 1 1 == 1 - + - gen[1] == 2 + gen.next() + + + true + + + + + gen.get() == 5 + + + 5 == 5 + + + + + gen.next() + + + true + + + + + gen.get() == 2 2 == 2 - + - gen[2] == 9 + gen.next() - 9 == 9 + true - + - gen[3] == 7 - - - 7 == 7 - - - -
-
- - - gen.size() == 2 - - - 2 == 2 - - - - - gen[0] == 3 - - - 3 == 3 - - - - - gen[1] == 1 - - - 1 == 1 - - - -
-
- - - gen.size() == 2 - - - 2 == 2 - - - - - gen[0] == 3 - - - 3 == 3 - - - - - gen[1] == 1 - - - 1 == 1 - - - -
-
- - - base->size() == 4 + gen.get() == 4 4 == 4 @@ -4034,37 +3869,88 @@ - typed + gen.next() - 0x + true - + - typed->size() == 4 + gen.get() == 0 - 4 == 4 + 0 == 0 - + - (*typed)[0] == 7 + !(gen.next()) - 7 == 7 + !false - + +
+
+ - (*typed)[3] == 11 + gen.get().size() == 2 - 11 == 11 + 2 == 2 - + + + gen.get() == "aa" + + + "aa" == "aa" + + + + + gen.next() + + + true + + + + + gen.get() == "bb" + + + "bb" == "bb" + + + + + gen.next() + + + true + + + + + gen.get() == "cc" + + + "cc" == "cc" + + + + + !(gen.next()) + + + !false + + +
@@ -11180,7 +11066,7 @@ loose text artifact
- + data.str.size() == data.len @@ -11215,6 +11101,41 @@ loose text artifact + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 5 == 5 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 6 == 6 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 5 == 5 + + + + + strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) + + + 6 == 6 + + + + Why would you throw a std::string? @@ -11733,7 +11654,7 @@ loose text artifact
- + - + diff --git a/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp b/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp index b3074b2e..0473b737 100644 --- a/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/GeneratorsImpl.tests.cpp @@ -1,93 +1,46 @@ #include "catch.hpp" -// Tests of generartor implementation details - -TEST_CASE("Generators impl", "[impl]") { +// Tests of generator implementation details +TEST_CASE("Generators internals", "[generators][internals]") { using namespace Catch::Generators; - SECTION( "range" ) { - auto gen = range(1,3); - - CHECK( gen.size() == 2 ); - - CHECK( gen[0] == 1 ); - CHECK( gen[1] == 2 ); + SECTION("Single value") { + auto gen = value(123); + REQUIRE(gen.get() == 123); + REQUIRE_FALSE(gen.next()); } - SECTION( "fixed values" ) { - auto gen = values( { 3, 1, 4, 1 } ); - - CHECK( gen.size() == 4 ); - CHECK( gen[0] == 3 ); - CHECK( gen[1] == 1 ); - CHECK( gen[2] == 4 ); - CHECK( gen[3] == 1 ); + SECTION("Preset values") { + auto gen = values({ 1, 3, 5 }); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 3); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 5); + REQUIRE_FALSE(gen.next()); } - SECTION( "combined" ) { - auto gen = makeGenerators( range( 1, 3 ), values( { 9, 7 } ) ); - - CHECK( gen.size() == 4 ); - CHECK( gen[0] == 1 ); - CHECK( gen[1] == 2 ); - CHECK( gen[2] == 9 ); - CHECK( gen[3] == 7 ); + SECTION("Generator combinator") { + auto gen = makeGenerators(1, 5, values({ 2, 4 }), 0); + REQUIRE(gen.get() == 1); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 5); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 2); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 4); + REQUIRE(gen.next()); + REQUIRE(gen.get() == 0); + REQUIRE_FALSE(gen.next()); } - - SECTION( "values" ) { - auto gen = makeGenerators( 3, 1 ); - - CHECK( gen.size() == 2 ); - CHECK( gen[0] == 3 ); - CHECK( gen[1] == 1 ); - } - SECTION( "values2" ) { - auto gen = makeGenerators( 3, 1 ); - - CHECK( gen.size() == 2 ); - CHECK( gen[0] == 3 ); - CHECK( gen[1] == 1 ); - } - - - SECTION( "type erasure" ) { - auto gen = makeGenerators( range( 7, 10 ), 11 ); - - // Make type erased version - auto dynCopy = pf::make_unique>( std::move( gen ) ); - std::unique_ptr base = std::move( dynCopy ); - - // Only thing we can do is ask for the size - CHECK( base->size() == 4 ); - - // Restore typed version - auto typed = dynamic_cast const*>( base.get() ); - REQUIRE( typed ); - CHECK( typed->size() == 4 ); - CHECK( (*typed)[0] == 7 ); - CHECK( (*typed)[3] == 11 ); - } -} - -TEST_CASE("Generators impl - random", "[approvals]") { - using namespace Catch::Generators; - - SECTION( "random range" ) { - auto gen = random( 3, 9 ); - - CHECK( gen.size() == 6 ); - for( size_t i = 0; i < 6; ++i ) { - CHECK( gen[i] >= 3 ); - CHECK( gen[i] <= 8 ); - if( i > 0 ) - CHECK( gen[i] != gen[i-1] ); - } - } - SECTION( "random selection" ) { - auto gen = random( 10 ); - - CHECK( gen.size() == 10 ); - for( size_t i = 0; i < 10; ++i ) { - if( i > 0 ) - CHECK( gen[i] != gen[i-1] ); - } + SECTION("Explicitly typed generator sequence") { + auto gen = makeGenerators(as{}, "aa", "bb", "cc"); + // This just checks that the type is std::string: + REQUIRE(gen.get().size() == 2); + // Iterate over the generator + REQUIRE(gen.get() == "aa"); + REQUIRE(gen.next()); + REQUIRE(gen.get() == "bb"); + REQUIRE(gen.next()); + REQUIRE(gen.get() == "cc"); + REQUIRE_FALSE(gen.next()); } } diff --git a/projects/SelfTest/UsageTests/Generators.tests.cpp b/projects/SelfTest/UsageTests/Generators.tests.cpp index 9242174a..b2a0c4e1 100644 --- a/projects/SelfTest/UsageTests/Generators.tests.cpp +++ b/projects/SelfTest/UsageTests/Generators.tests.cpp @@ -1,53 +1,58 @@ #include "catch.hpp" -// Examples of usage of Generators +#include -// This test doesn't do much - it just shows how you can have several generators, of different -// types (ie `i` and `j` are different types), can be sequenced using `,` and -// can be expressed as named generators (like range) or as individual values. -// Generators can be mixed with SECTIONs. -// At time of writing the generated values are not automatically reported as part of the test -// name or associated values - so we explicitly CAPTURE then (run this with `-s` to see them). -// We could also incorporate them into the section names using DYNAMIC_SECTION. See the BDD -// example later for more information. -TEST_CASE("Generators") { - auto i = GENERATE( as(), "a", "b", "c" ); - - SECTION( "one" ) { - auto j = GENERATE( range( 8, 11 ), 2 ); - - CAPTURE( i, j ); - SUCCEED(); +// Generators and sections can be nested freely +TEST_CASE("Generators -- simple", "[generators]") { + auto i = GENERATE(1, 2, 3); + SECTION("one") { + auto j = GENERATE(values({ -3, -2, -1 })); + REQUIRE(j < i); } - SECTION( "two" ) { - auto j = GENERATE( 3.141, 1.379 ); - CAPTURE( i, j ); - SUCCEED(); + + SECTION("two") { + // You can also explicitly set type for generators via Catch::Generators::as + auto str = GENERATE(as{}, "a", "bb", "ccc"); + REQUIRE(4u * i > str.size()); } } -// This one generates the cross-product of two ranges. -// It's mostly here to demonstrate the performance which, at time of writing, -// leaves a lot to be desired. -TEST_CASE( "100x100 ints", "[.][approvals]" ) { - auto x = GENERATE( range( 0,100 ) ); - auto y = GENERATE( range( 200,300 ) ); - - CHECK( x < y ); +// You can create a cartesian-product of generators by creating multiple ones +TEST_CASE("3x3x3 ints", "[generators]") { + auto x = GENERATE(1, 2, 3); + auto y = GENERATE(4, 5, 6); + auto z = GENERATE(7, 8, 9); + // These assertions will be run 27 times (3x3x3) + CHECK(x < y); + CHECK(y < z); + REQUIRE(x < z); } -// smaller version -TEST_CASE( "10x10 ints" ) { - auto x = GENERATE( range( 1,11 ) ); - auto y = GENERATE( range( 101, 111 ) ); +// You can also create data tuples +TEST_CASE("tables", "[generators]") { + // Note that this will not compile with libstdc++ older than libstdc++6 + // See https://stackoverflow.com/questions/12436586/tuple-vector-and-initializer-list + // for possible workarounds + // auto data = GENERATE(table({ + // {"first", 5}, + // {"second", 6}, + // {"third", 5}, + // {"etc...", 6} + // })); - CHECK( x < y ); + // Workaround for the libstdc++ bug mentioned above + using tuple_type = std::tuple; + auto data = GENERATE(table({ + tuple_type{"first", 5}, + tuple_type{"second", 6}, + tuple_type{"third", 5}, + tuple_type{"etc...", 6} + })); + + REQUIRE(strlen(std::get<0>(data)) == static_cast(std::get<1>(data))); } -// Some of the following tests use structured bindings for convenience and so are -// conditionally compiled using the de-facto (and soon to be formally) standard -// feature macros #ifdef __cpp_structured_bindings @@ -56,7 +61,7 @@ TEST_CASE( "10x10 ints" ) { // but it demonstrates a possible usage. // Spelling out the pair like this is a bit verbose, so read on for better examples // - the use of structured bindings here is an optional convenience -TEST_CASE( "strlen", "[approvals]" ) { +TEST_CASE( "strlen", "[approvals][generators]" ) { auto [test_input, expected] = GENERATE( values>({ {"one", 3}, {"two", 3}, @@ -69,7 +74,7 @@ TEST_CASE( "strlen", "[approvals]" ) { // A nicer way to do pairs (or more) of values - using the table generator. // Note, you must specify the types up-front. -TEST_CASE( "strlen2", "[approvals]" ) { +TEST_CASE( "strlen2", "[approvals][generators]" ) { auto [test_input, expected] = GENERATE( table({ {"one", 3}, {"two", 3}, @@ -81,11 +86,11 @@ TEST_CASE( "strlen2", "[approvals]" ) { } #endif -// An alternate way of doing data tables without structure bindings -// - I'd prefer to have the Data class within the test case but gcc 4.x doesn't seem to like it + +// An alternate way of doing data tables without structured bindings struct Data { std::string str; size_t len; }; -TEST_CASE( "strlen3" ) { +TEST_CASE( "strlen3", "[generators]" ) { auto data = GENERATE( values({ {"one", 3}, {"two", 3}, @@ -96,15 +101,7 @@ TEST_CASE( "strlen3" ) { REQUIRE( data.str.size() == data.len ); } -// A nod towards property-based testing - generate a random selection of numbers -// in a range and assert on global properties those numbers. -static auto square( int i ) -> int { return i*i; } -TEST_CASE( "Random numbers in a range", "[.][approvals]" ) { - auto x = GENERATE( random( -10000, 10000 ) ); - CAPTURE( x ); - REQUIRE( square(x) >= 0 ); -} #ifdef __cpp_structured_bindings @@ -118,7 +115,7 @@ TEST_CASE( "Random numbers in a range", "[.][approvals]" ) { static auto eatCucumbers( int start, int eat ) -> int { return start-eat; } -SCENARIO("Eating cucumbers", "[approvals]") { +SCENARIO("Eating cucumbers", "[generators][approvals]") { auto [start, eat, left] = GENERATE( table ({ { 12, 5, 7 },