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

Test Double (an alternative to CppUMock) #1199

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

Conversation

redengin
Copy link

@redengin redengin commented Mar 6, 2019

see README_TestDouble.md for rationale and design.

Niko Kontio and others added 9 commits March 6, 2019 03:23
Shuffling is off by default.

-s enables shuffling with random seed derived from current time.

The seed is printed before executing tests. A specific test execution
order can be reproduced by setting the seed explicitly with -s <seed>.

Seed values 0 and 1 are reserved values and cannot be set.

If -v (verbose) is enabled, the seed is also printed after test
execution. This might be useful in case tests produce console output
which could cause the seed printed at the beginning to be lost.

Test order is reshuffled between repeats (-r).

Co-authored-by: Risto-Matti Vuonnala <rivuonna@nokia.com>
- Use defines for reserved values of random seed
- Removed some redundant unit tests
- Remove use of C++ standard library headers:
-- Implement own shuffle algorithm instead of using random_shuffle from <algorithm>
-- Use dynamic array instead of vector from <vector>
- Implement and use AtoU to parse unsigned integers from strings
- Remove dead code from TestResult
- Better unit test coverage

Also other improvements:
- Randomizer seed is printed on the same line as the test result summary
- Document the shuffling feature in the manual
…tion in VisualCppTimeInMillis due to absence of timeGetTime() API in UWP (TIMERR_NOERROR can be used to detect presence of timeGetTime() API).
Remove output parameter from AtoU. As a consequence, seed value 0
(-s 0) is now treated as an invalid command line parameter. It was
redundant anyway, because value 0, i.e., "shuffle disabled" is the
default when -s is not given.

Also cover rand_() in unit tests.
@coveralls
Copy link

coveralls commented Mar 8, 2019

Coverage Status

Coverage decreased (-0.3%) to 99.55% when pulling 2c8d551 on redengin:master into ddb05a0 on cpputest:master.

@redengin
Copy link
Author

redengin commented Mar 8, 2019

hmm, nullptr was standardized in C++11 but yet this harness requires C++03 compatibility.
http://open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#903

whats the path forward?

@basvodde
Copy link
Member

basvodde commented Mar 9, 2019

I'm still not sure why this pull request, but I'll have a look at it at a later time.

We will keep compatibility as the unit test framework is frequently used in embedded systems and they often use old compilers.

@redengin
Copy link
Author

redengin commented Mar 9, 2019

As far as I can tell, nullptr is now also a compiler intrinsic that can't be decoupled from the compiler.
https://stackoverflow.com/questions/10496824/how-to-define-nullptr-for-supporting-both-c03-and-c11

As well, this test harness's use of CLANG's opinion to deprecate implicit class methods seems like an attempt to redefine C++ in a way that is no longer compatible with the C++11 standard nor code written to C++ standards before C++11.

I'd like to pass the gauntlet harness, but I have no idea of which syntax is required. Has the harness been tuned to ignore opinions about cpputest/master?

@basvodde
Copy link
Member

Gauntlet harness?

@redengin
Copy link
Author

By "gauntlet harness" I mean the set of test harnesses to validate pull requests (travis, coveralls, appveyor)

@basvodde
Copy link
Member

Ok. It isn't tuned ?

@redengin
Copy link
Author

By "tuned" I mean does it ignore some errors that would have been generated by standard CppUTest code (i.e. 0 vs nullptr initialization of pointers).

@basvodde
Copy link
Member

I'm not 100% sure, it should be in the CMake and autotools files.

@redengin
Copy link
Author

What do you think about Test Double design?

@basvodde
Copy link
Member

I'm yet to discover why :) If I have more time, I'll browse through the code.

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.

None yet

7 participants