2015-10-23 19:20:33 +02:00
|
|
|
/*
|
|
|
|
* Created by Phil on 1/10/2015.
|
|
|
|
* Copyright 2015 Two Blue Cubes Ltd
|
|
|
|
*
|
|
|
|
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
|
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
|
|
*/
|
|
|
|
#include "internal/catch_suppress_warnings.h"
|
2017-09-07 12:24:33 +02:00
|
|
|
#include "internal/catch_test_case_tracker.h"
|
2015-10-23 19:20:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
namespace Catch
|
|
|
|
{
|
2015-10-23 19:44:48 +02:00
|
|
|
class LocalContext {
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:44:48 +02:00
|
|
|
public:
|
|
|
|
TrackerContext& operator()() const {
|
|
|
|
return TrackerContext::instance();
|
|
|
|
}
|
|
|
|
};
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
} // namespace Catch
|
|
|
|
|
|
|
|
// -------------------
|
|
|
|
|
|
|
|
#include "catch.hpp"
|
|
|
|
|
|
|
|
using namespace Catch;
|
|
|
|
|
2018-07-02 11:13:07 +02:00
|
|
|
namespace {
|
2017-01-12 18:10:38 +01:00
|
|
|
Catch::TestCaseTracking::NameAndLocation makeNAL( std::string const& name ) {
|
2017-08-08 02:02:24 +02:00
|
|
|
return Catch::TestCaseTracking::NameAndLocation( name, Catch::SourceLineInfo("",0) );
|
2017-01-12 18:10:38 +01:00
|
|
|
}
|
2018-07-02 11:13:07 +02:00
|
|
|
}
|
2017-01-12 18:10:38 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
TEST_CASE( "Tracker" ) {
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
TrackerContext ctx;
|
|
|
|
ctx.startRun();
|
|
|
|
ctx.startCycle();
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
|
|
|
|
ITracker& testCase = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase.isOpen() );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1 = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1.isOpen() );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "successfully close one section" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
s1.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1.isSuccessfullyCompleted() );
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
|
|
|
testCase.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
|
|
|
REQUIRE( testCase.isSuccessfullyCompleted() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "fail one section" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
s1.fail();
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( s1.isComplete() );
|
2015-10-23 19:44:48 +02:00
|
|
|
REQUIRE( s1.isSuccessfullyCompleted() == false );
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
2015-10-23 19:44:48 +02:00
|
|
|
REQUIRE( testCase.isSuccessfullyCompleted() == false );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "re-enter after failed section" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:02:40 +01:00
|
|
|
REQUIRE( s1b.isOpen() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase2.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase.isComplete() );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase.isSuccessfullyCompleted() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "re-enter after failed section and find next section" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1b.isOpen() == false );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-23 19:20:33 +02:00
|
|
|
REQUIRE( s2.isOpen() );
|
2015-10-29 09:17:55 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
s2.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase2.close();
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase.isComplete() );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase.isSuccessfullyCompleted() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "successfully close one section, then find another" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
s1.close();
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-23 19:20:33 +02:00
|
|
|
REQUIRE( s2.isOpen() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase.close();
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Re-enter - skips S1 and enters S2" ) {
|
2015-10-23 19:20:33 +02:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-23 19:44:48 +02:00
|
|
|
REQUIRE( s1b.isOpen() == false );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-23 19:20:33 +02:00
|
|
|
REQUIRE( s2b.isOpen() );
|
|
|
|
|
|
|
|
REQUIRE( ctx.completedCycle() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
SECTION ("Successfully close S2") {
|
|
|
|
s2b.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s2b.isSuccessfullyCompleted() );
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( testCase2.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase2.close();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isSuccessfullyCompleted() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
|
|
|
SECTION ("fail S2") {
|
|
|
|
s2b.fail();
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( ctx.completedCycle() );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
2015-10-29 09:33:50 +01:00
|
|
|
REQUIRE( s2b.isComplete() );
|
2015-10-23 19:44:48 +02:00
|
|
|
REQUIRE( s2b.isSuccessfullyCompleted() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase2.close();
|
2015-10-23 19:44:48 +02:00
|
|
|
REQUIRE( testCase2.isSuccessfullyCompleted() == false );
|
2015-10-29 09:17:55 +01:00
|
|
|
|
|
|
|
// Need a final cycle
|
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase3 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase3.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1c = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1c.isOpen() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2c = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s2c.isOpen() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:17:55 +01:00
|
|
|
testCase3.close();
|
|
|
|
REQUIRE( testCase3.isSuccessfullyCompleted() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "open a nested section" ) {
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s2.isOpen() );
|
2015-10-23 19:20:33 +02:00
|
|
|
|
|
|
|
s2.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2.isComplete() );
|
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
s1.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1.isComplete() );
|
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-23 19:20:33 +02:00
|
|
|
testCase.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase.isComplete() );
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "start a generator" ) {
|
2017-01-12 18:10:38 +01:00
|
|
|
IndexTracker& g1 = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( g1.isOpen() );
|
2015-10-29 09:02:40 +01:00
|
|
|
REQUIRE( g1.index() == 0 );
|
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( g1.isComplete() == false );
|
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-10-29 09:02:40 +01:00
|
|
|
|
|
|
|
SECTION( "close outer section" )
|
|
|
|
{
|
|
|
|
s1.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-10-29 09:02:40 +01:00
|
|
|
testCase.close();
|
|
|
|
REQUIRE( testCase.isSuccessfullyCompleted() == false );
|
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Re-enter for second generation" ) {
|
2015-10-29 09:02:40 +01:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1b.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( g1b.isOpen() );
|
2015-10-29 09:02:40 +01:00
|
|
|
REQUIRE( g1b.index() == 1 );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
s1b.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1b.isComplete() );
|
|
|
|
REQUIRE( g1b.isComplete() );
|
2015-10-29 09:02:40 +01:00
|
|
|
testCase2.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase2.isComplete() );
|
2015-10-29 09:02:40 +01:00
|
|
|
}
|
|
|
|
}
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Start a new inner section" ) {
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s2.isOpen() );
|
2015-10-29 09:02:40 +01:00
|
|
|
|
|
|
|
s2.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2.isComplete() );
|
2015-10-29 09:02:40 +01:00
|
|
|
|
|
|
|
s1.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-10-29 09:02:40 +01:00
|
|
|
|
|
|
|
testCase.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Re-enter for second generation" ) {
|
2015-10-29 09:02:40 +01:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s1b.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
// generator - next value
|
2017-01-12 18:10:38 +01:00
|
|
|
IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( g1b.isOpen() );
|
2015-10-29 09:02:40 +01:00
|
|
|
REQUIRE( g1b.index() == 1 );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
// inner section again
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 09:17:55 +01:00
|
|
|
REQUIRE( s2b.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
s2b.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2b.isComplete() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
s1b.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( g1b.isComplete() );
|
|
|
|
REQUIRE( s1b.isComplete() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 09:02:40 +01:00
|
|
|
testCase2.close();
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase2.isComplete() );
|
|
|
|
}
|
|
|
|
}
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Fail an inner section" ) {
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2 = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
s2.fail();
|
|
|
|
REQUIRE( s2.isComplete() );
|
|
|
|
REQUIRE( s2.isSuccessfullyCompleted() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
s1.close();
|
|
|
|
REQUIRE( s1.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
testCase.close();
|
|
|
|
REQUIRE( testCase.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-07-13 10:20:37 +02:00
|
|
|
SECTION( "Re-enter for second generation" ) {
|
2015-10-29 20:25:27 +01:00
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase2 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase2.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1b = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1b.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
// generator - still same value
|
2017-01-12 18:10:38 +01:00
|
|
|
IndexTracker& g1b = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( g1b.isOpen() );
|
|
|
|
REQUIRE( g1b.index() == 0 );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
// inner section again - this time won't open
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2b = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2b.isOpen() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
s1b.close();
|
|
|
|
REQUIRE( g1b.isComplete() == false );
|
|
|
|
REQUIRE( s1b.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
testCase2.close();
|
|
|
|
REQUIRE( testCase2.isComplete() == false );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
// Another cycle - now should complete
|
|
|
|
ctx.startCycle();
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& testCase3 = SectionTracker::acquire( ctx, makeNAL( "Testcase" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( testCase3.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s1c = SectionTracker::acquire( ctx, makeNAL( "S1" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s1c.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
// generator - now next value
|
2017-01-12 18:10:38 +01:00
|
|
|
IndexTracker& g1c = IndexTracker::acquire( ctx, makeNAL( "G1" ), 2 );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( g1c.isOpen() );
|
|
|
|
REQUIRE( g1c.index() == 1 );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
// inner section - now should open again
|
2017-01-12 18:10:38 +01:00
|
|
|
ITracker& s2c = SectionTracker::acquire( ctx, makeNAL( "S2" ) );
|
2015-10-29 20:25:27 +01:00
|
|
|
REQUIRE( s2c.isOpen() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
s2c.close();
|
|
|
|
REQUIRE( s2c.isComplete() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
s1c.close();
|
|
|
|
REQUIRE( g1c.isComplete() );
|
|
|
|
REQUIRE( s1c.isComplete() );
|
2015-11-04 19:01:28 +01:00
|
|
|
|
2015-10-29 20:25:27 +01:00
|
|
|
testCase3.close();
|
|
|
|
REQUIRE( testCase3.isComplete() );
|
2015-10-29 09:02:40 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// !TBD"
|
|
|
|
// nested generator
|
|
|
|
// two sections within a generator
|
|
|
|
}
|
2015-10-23 19:20:33 +02:00
|
|
|
}
|