Add test for AND_GIVEN and update the baselines

This commit is contained in:
Martin Hořeňovský 2018-09-02 15:38:33 +02:00
parent 64fd5b8058
commit efbf50fc7d
4 changed files with 58 additions and 50 deletions

View File

@ -6319,7 +6319,7 @@ PASSED:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or
methods methods
Given: No operations precede me Given: No operations precede me
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6333,9 +6333,9 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or
methods methods
Given: No operations precede me Given: No operations precede me
When: We get the count When: We get the count
Then: Subsequently values are higher Then: Subsequently values are higher
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6348,9 +6348,10 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Do that thing with the thing Scenario: Do that thing with the thing
Given: This stuff exists Given: This stuff exists
When: I do this And given: And some assumption
Then: it should do this When: I do this
Then: it should do this
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6363,10 +6364,11 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Do that thing with the thing Scenario: Do that thing with the thing
Given: This stuff exists Given: This stuff exists
When: I do this And given: And some assumption
Then: it should do this When: I do this
And: do that Then: it should do this
And: do that
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6380,12 +6382,12 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: This is a really long scenario name to see how the list command deals Scenario: This is a really long scenario name to see how the list command deals
with wrapping with wrapping
Given: A section name that is so long that it cannot fit in a single Given: A section name that is so long that it cannot fit in a single
console width console width
When: The test headers are printed as part of the normal running of the When: The test headers are printed as part of the normal running of the
scenario scenario
Then: The, deliberately very long and overly verbose (you see what I did Then: The, deliberately very long and overly verbose (you see what I did
there?) section names must wrap, along with an indent there?) section names must wrap, along with an indent
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6397,7 +6399,7 @@ with message:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity Scenario: Vector resizing affects size and capacity
Given: an empty vector Given: an empty vector
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6410,9 +6412,9 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity Scenario: Vector resizing affects size and capacity
Given: an empty vector Given: an empty vector
When: it is made larger When: it is made larger
Then: the size and capacity go up Then: the size and capacity go up
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6431,11 +6433,11 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity Scenario: Vector resizing affects size and capacity
Given: an empty vector Given: an empty vector
When: it is made larger When: it is made larger
Then: the size and capacity go up Then: the size and capacity go up
And when: it is made smaller again And when: it is made smaller again
Then: the size goes down but the capacity stays the same Then: the size goes down but the capacity stays the same
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6454,7 +6456,7 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity Scenario: Vector resizing affects size and capacity
Given: an empty vector Given: an empty vector
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................
@ -6467,9 +6469,9 @@ with expansion:
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Scenario: Vector resizing affects size and capacity Scenario: Vector resizing affects size and capacity
Given: an empty vector Given: an empty vector
When: we reserve more space When: we reserve more space
Then: The capacity is increased but the size remains the same Then: The capacity is increased but the size remains the same
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
BDD.tests.cpp:<line number> BDD.tests.cpp:<line number>
............................................................................... ...............................................................................

View File

@ -522,8 +522,8 @@ Matchers.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="SUCCEED does not require an argument" time="{duration}"/> <testcase classname="<exe-name>.global" name="SUCCEED does not require an argument" time="{duration}"/>
<testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/> <testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/>
<testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/> <testcase classname="<exe-name>.Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/When: I do this/Then: it should do this" time="{duration}"/> <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/When: I do this/Then: it should do this/And: do that" time="{duration}"/> <testcase classname="<exe-name>.global" name="Scenario: Do that thing with the thing/Given: This stuff exists/And given: And some assumption/When: I do this/Then: it should do this/And: do that" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Scenario: This is a really long scenario name to see how the list command deals with wrapping/Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/> <testcase classname="<exe-name>.global" name="Scenario: This is a really long scenario name to see how the list command deals with wrapping/Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector" time="{duration}"/> <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up" time="{duration}"/> <testcase classname="<exe-name>.global" name="Scenario: Vector resizing affects size and capacity/Given: an empty vector/When: it is made larger/Then: the size and capacity go up" time="{duration}"/>

View File

@ -6644,26 +6644,29 @@
</TestCase> </TestCase>
<TestCase name="Scenario: Do that thing with the thing" tags="[Tags]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <TestCase name="Scenario: Do that thing with the thing" tags="[Tags]" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Section name="Given: This stuff exists" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Given: This stuff exists" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Section name="When: I do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="And given: And some assumption" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Section name="Then: it should do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="When: I do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <Section name="Then: it should do this" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Original>
itDoesThis()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Section name="And: do that" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Original> <Original>
itDoesThat() itDoesThis()
</Original> </Original>
<Expanded> <Expanded>
true true
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/> <Section name="And: do that" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="projects/<exe-name>/UsageTests/BDD.tests.cpp" >
<Original>
itDoesThat()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResults successes="1" failures="0" expectedFailures="0"/>
</Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>
<OverallResults successes="2" failures="0" expectedFailures="0"/> <OverallResults successes="2" failures="0" expectedFailures="0"/>
</Section> </Section>

View File

@ -38,11 +38,14 @@ namespace { namespace BDDTests {
SCENARIO("Do that thing with the thing", "[Tags]") { SCENARIO("Do that thing with the thing", "[Tags]") {
GIVEN("This stuff exists") { GIVEN("This stuff exists") {
// make stuff exist // make stuff exist
WHEN("I do this") { AND_GIVEN("And some assumption") {
// do this // Validate assumption
THEN("it should do this") { WHEN("I do this") {
REQUIRE(itDoesThis()); // do this
AND_THEN("do that")REQUIRE(itDoesThat()); THEN("it should do this") {
REQUIRE(itDoesThis());
AND_THEN("do that")REQUIRE(itDoesThat());
}
} }
} }
} }