Ocean
Loading...
Searching...
No Matches
TestSingleton.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
9#define META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
10
13
15
16namespace Ocean
17{
18
19namespace Test
20{
21
22namespace TestBase
23{
24
25/**
26 * This class implements a singleton test.
27 * @ingroup testbase
28 */
29class OCEAN_TEST_BASE_EXPORT TestSingleton
30{
31 protected:
32
33 /**
34 * This class implements a helper class to test singleton template.
35 */
36 class SingletonUser : public Ocean::Singleton<SingletonUser>
37 {
38 friend class Ocean::Singleton<SingletonUser>;
39
40 public:
41
42 /**
43 * Returns a value.
44 * @return Return value
45 */
46 unsigned int value() const;
47
48 protected:
49
50 /**
51 * Creates a new object.
52 */
54
55 /**
56 * Destructs a value.
57 */
58 virtual ~SingletonUser();
59
60 protected:
61
62 /// Object value.
63 unsigned int userValue;
64 };
65
66 public:
67
68 /**
69 * Tests all singleton functions.
70 * @param selector The test selector to select the tests to run
71 * @return True, if succeeded
72 */
73 static bool test(const TestSelector& selector = TestSelector());
74
75 /**
76 * Tests the get function (creating the instance).
77 * @return True, if succeeded
78 */
79 static bool testInstance();
80};
81
82}
83
84}
85
86}
87
88#endif // META_OCEAN_TEST_TESTBASE_TEST_SINGLETON_H
This template class is the base class for all singleton objects.
Definition Singleton.h:71
This class implements a helper class to test singleton template.
Definition TestSingleton.h:37
unsigned int value() const
Returns a value.
unsigned int userValue
Object value.
Definition TestSingleton.h:63
This class implements a singleton test.
Definition TestSingleton.h:30
static bool test(const TestSelector &selector=TestSelector())
Tests all singleton functions.
This class implements a test selector that parses test function strings and determines which tests sh...
Definition TestSelector.h:51
The namespace covering the entire Ocean framework.
Definition Accessor.h:15