You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Duplicate of #886 but the cause seems to be the "-d yes" command-line args. To avoid further confusion, I recommend revising title of issue #886 and marking this issue as duplicate, or accepting this issue and marking #886 as duplicate.
Description
Reporting timings feature (using "-d yes" for duration) displays BDD given-when-then in the wrong order.
Expected behaviour:
Should display the given-when-then in the declared order of the CPP file.
Steps to reproduce:
GIVEN this CPP file:
#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include <chrono>
#include <thread>
SCENARIO( "vectors can be sized and resized", "[vector]" ) {
GIVEN( "A vector with some items" ) {
std::vector<int> v( 5 );
REQUIRE( v.size() == 5 );
REQUIRE( v.capacity() >= 5 );
WHEN( "the size is increased" ) {
v.resize( 10 );
THEN( "the size and capacity change" ) {
std::this_thread::sleep_for(std::chrono::seconds(1));
REQUIRE( v.size() == 10 );
REQUIRE( v.capacity() >= 10 );
}
}
WHEN( "the size is reduced" ) {
v.resize( 0 );
THEN( "the size changes but not capacity" ) {
REQUIRE( v.size() == 0 );
REQUIRE( v.capacity() >= 5 );
}
}
WHEN( "more capacity is reserved" ) {
v.reserve( 10 );
THEN( "the capacity changes but not the size" ) {
REQUIRE( v.size() == 5 );
REQUIRE( v.capacity() >= 10 );
}
}
WHEN( "less capacity is reserved" ) {
v.reserve( 0 );
THEN( "neither size nor capacity are changed" ) {
REQUIRE( v.size() == 5 );
REQUIRE( v.capacity() >= 5 );
}
}
}
}
1.001 s: Then: the size and capacity change
1.001 s: When: the size is increased
1.001 s: Given: A vector with some items
1.001 s: Scenario: vectors can be sized and resized
0.000 s: Then: the size changes but not capacity
0.000 s: When: the size is reduced
0.000 s: Given: A vector with some items
0.000 s: Scenario: vectors can be sized and resized
0.000 s: Then: the capacity changes but not the size
0.000 s: When: more capacity is reserved
0.000 s: Given: A vector with some items
0.000 s: Scenario: vectors can be sized and resized
0.000 s: Then: neither size nor capacity are changed
0.000 s: When: less capacity is reserved
0.000 s: Given: A vector with some items
0.000 s: Scenario: vectors can be sized and resized
===============================================================================
All tests passed (16 assertions in 1 test case)
Expected behaviour:
Should display the given-when-then in the declared order of the CPP file.
Additional notes:
I tried different permutations, and without thread sleep and still encounter the same issue.
System information:
Catch version: v2.0.1
Operating System: Mac OS X 10.13.1
Compiler+version: Clang x86_64-apple-darwin17.2.0, Apple LLVM version 9.0.0 (clang-900.0.38)
The text was updated successfully, but these errors were encountered:
lnorr
changed the title
Catch "reporting timings" feature displays BDD given-when-then in the wrong order
Reporting timings feature displays BDD given-when-then in the wrong order
Nov 25, 2017
Update
Duplicate of #886 but the cause seems to be the "-d yes" command-line args. To avoid further confusion, I recommend revising title of issue #886 and marking this issue as duplicate, or accepting this issue and marking #886 as duplicate.
Description
Reporting timings feature (using "-d yes" for duration) displays BDD given-when-then in the wrong order.
Expected behaviour:
Should display the given-when-then in the declared order of the CPP file.
Steps to reproduce:
GIVEN this CPP file:
WHEN I run the test:
THEN I do NOT want to get this result:
Expected behaviour:
Should display the given-when-then in the declared order of the CPP file.
Additional notes:
I tried different permutations, and without thread sleep and still encounter the same issue.
System information:
The text was updated successfully, but these errors were encountered: