File tree 2 files changed +4
-3
lines changed
include/test_polymorphism 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change 1
1
#ifndef POLYMORPHISM_MOCKING_HPP
2
2
#define POLYMORPHISM_MOCKING_HPP
3
3
4
+ #include < atomic>
4
5
#include < cstddef>
5
6
#include < list>
6
7
#include < string>
@@ -9,7 +10,7 @@ namespace mocking {
9
10
10
11
struct Mock {
11
12
std::list<std::string> collectedSetArguments;
12
- mutable std::size_t numberOfCallsToCoolFeature { 0 };
13
+ mutable std::atomic<std:: size_t > numberOfCallsToCoolFeature { 0 };
13
14
14
15
std::string coolFeature () const
15
16
{
Original file line number Diff line number Diff line change @@ -56,15 +56,15 @@ int main()
56
56
when (" I pass it to a function that expects an argument that fulfils the constraints" ) = [&] {
57
57
auto result = modern::consume (impl);
58
58
59
- then (" set() should be called twice" ) = [= ] {
59
+ then (" set() should be called twice" ) = [& ] {
60
60
expect (EXPECTED_COOLFEATURE_CALLS == impl.numberOfCallsToCoolFeature );
61
61
};
62
62
63
63
then (" the answer to all questions should be given" ) = [=] {
64
64
expect (" The answer to all questions is 42" s == result);
65
65
};
66
66
67
- then (" the state of the argument should be modified as a side effect" ) = [= ] {
67
+ then (" the state of the argument should be modified as a side effect" ) = [& ] {
68
68
expect (" 42" s == impl.coolFeature ());
69
69
};
70
70
};
You can’t perform that action at this time.
0 commit comments