|
Last change
on this file since 8624d1f was b57ba05, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago |
|
Update headers in C++ files
|
-
Property mode
set to
100644
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | * SPDX-FileCopyrightText: 2017 Jaroslav Jindrak
|
|---|
| 3 | *
|
|---|
| 4 | * SPDX-License-Identifier: BSD-3-Clause
|
|---|
| 5 | */
|
|---|
| 6 |
|
|---|
| 7 | #ifndef LIBCPP_BITS_TEST_MOCK
|
|---|
| 8 | #define LIBCPP_BITS_TEST_MOCK
|
|---|
| 9 |
|
|---|
| 10 | #include <cstdlib>
|
|---|
| 11 | #include <tuple>
|
|---|
| 12 |
|
|---|
| 13 | namespace std::test
|
|---|
| 14 | {
|
|---|
| 15 | /**
|
|---|
| 16 | * Auxiliary type that lets us to monitor the number
|
|---|
| 17 | * of calls to various functions for the purposes
|
|---|
| 18 | * of testing smart pointers and other features of
|
|---|
| 19 | * the library.
|
|---|
| 20 | */
|
|---|
| 21 | struct mock
|
|---|
| 22 | {
|
|---|
| 23 | static size_t constructor_calls;
|
|---|
| 24 | static size_t copy_constructor_calls;
|
|---|
| 25 | static size_t destructor_calls;
|
|---|
| 26 | static size_t move_constructor_calls;
|
|---|
| 27 |
|
|---|
| 28 | mock()
|
|---|
| 29 | {
|
|---|
| 30 | ++constructor_calls;
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | mock(const mock&)
|
|---|
| 34 | {
|
|---|
| 35 | ++copy_constructor_calls;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | mock(mock&&)
|
|---|
| 39 | {
|
|---|
| 40 | ++move_constructor_calls;
|
|---|
| 41 | }
|
|---|
| 42 |
|
|---|
| 43 | ~mock()
|
|---|
| 44 | {
|
|---|
| 45 | ++destructor_calls;
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | static void clear()
|
|---|
| 49 | {
|
|---|
| 50 | constructor_calls = size_t{};
|
|---|
| 51 | copy_constructor_calls = size_t{};
|
|---|
| 52 | destructor_calls = size_t{};
|
|---|
| 53 | move_constructor_calls = size_t{};
|
|---|
| 54 | }
|
|---|
| 55 | };
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | #endif
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.