Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature and stability updates #7

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Sp3EdeR
Copy link

@Sp3EdeR Sp3EdeR commented Nov 16, 2023

  • Added support for gTest v1.12.0 (fixed multiple compilation issues)
  • Added typed test support for gTest (SCENARIO_T)
  • Added support for gMock expectations by provising the THEN(EXPECT()) clause. This allows writing "then" statements before writing the "when" section while keeping the output fully BDD compatible.
  • Added checks against using the same clause multiple times in a scenario.

Sandor Bodo-Merle and others added 7 commits May 15, 2023 12:36
Description:
cppbdd fails to compile with current googletest (newer than v1.12.0):

  thirdparty/cppbdd/include/cppbdd/gtestbdd.h:155:50: error: ISO C++ forbids
  declaration of ‘GTEST_DISALLOW_COPY_AND_ASSIGN_’ with no type [-fpermissive]
    155 |         GTEST_DISALLOW_COPY_AND_ASSIGN_(TestClass);\
        |                                                  ^

Root Cause:
Since googletest v1.12.0 the GTEST_DISALLOW_COPY_AND_ASSIGN_ macro was
removed by commit bf66935e ("Remove the legacy internal GTEST_DISALLOW_* macros", 2022-04-22).

Solution:
Replace the macro by plain C++ code (as was done by googletest itself).

Resolves: SWPF-241
Change-Id: Ic38be1adfaf0e0228bc79c029b52410d2d564d3a
Signed-off-by: Sandor Bodo-Merle <[email protected]>
Description:
Replace INSTANTIATE_TEST_CASE_P macro with the current recommended
INSTANTIATE_TEST_SUITE_P macro.

Root Cause:
Since v1.10.0 GoogleTest deprecated the INSTANTIATE_TEST_SUITE_P macro in
commit 52ea4f7b ("Mark legacy _TEST_CASE_ macros as deprecated", 2019-02-04).

Solution:
s/INSTANTIATE_TEST_CASE_P/INSTANTIATE_TEST_SUITE_P/

Resolves: SWPF-260
Change-Id: Id46f56f6f5995039de9fb50daddc3b0a3896fd65
Signed-off-by: Sandor Bodo-Merle <[email protected]>
Description:
Introduce the SCENARIO_T macro.

Root Cause:
CPPBDD does not provide Type Tests.

Solution:
Introduce MAKE_SCENARIO_T based on
https://github.com/google/googletest/blob/v1.13.0/googletest/include/gtest/gtest-typed-test.h#L197-L224

The name mapping used was :
      FixtureClass == CaseName

Note - it also replaces the deprecated GTEST_DISALLOW_COPY_AND_ASSIGN_
macro in MAKE_SCENARIO_P.

Resolves: SWPF-260
Change-Id: I9c60f24c800e28cfc4f30ced4465e31c8aedcce2
Signed-off-by: Sandor Bodo-Merle <[email protected]>
Description:
When a test uses GMOCK, the mock instrumentation may contain
expectations as well, so we would like to add THEN parts to the BDD
scenario after the GIVEN part which will printed out just before the
THEN part.

Root Cause:
New Feature

Solution:
Add EXPECT macro which can be used inside THEN macro

Resolves: SWPF-256
Change-Id: If2415b46105894c10d00bdb10f5acae4ec9d90e7
Description:
error message:
> comparison of integer expressions of different signedness: 'int'
> and 'std::vector<std::__cxx11::basic_string<char> >::size_type'
> {aka 'long unsigned int'} [-Werror=sign-compare]
>   103 |                for (auto i = 1; i < mThenExpects.size(); ++i)

Root Cause:
Introduction of -Werror flag.

Solution:
Changed auto to unsigned long.

Resolves: SWPF-326
Change-Id: Idebb78a1ed2adfaeb5f779de9d587f1fc691a32b
Signed-off-by: Orgilbold Zardikan <[email protected]>
Description:
Fixing the MAKE_SCENARIO_P macro

Root Cause:
It was fitted to an older version of gtest

Solution:
Fitted to the current version

Resolves: SWPF-255
Change-Id: I1bd6ac697e76f673b674680fa266ff59839055a0
Signed-off-by: attila.vago <[email protected]>
Description:
A BDD scenario should only allow defining

Root Cause:
New Feature

Resolves: SWPF-892
Change-Id: I1db58f98845cba7e65ca492a1a31efe3a5cea69a
Signed-off-by: Robert Jamnitzky <[email protected]>
@Sp3EdeR
Copy link
Author

Sp3EdeR commented Nov 16, 2023

If you need me to split the PR, I can do it. I just didn't want to put in the additional work in case it is not needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants