Skip to content

Commit 85bce14

Browse files
committed
Improve compatibility between base_control_t and control_t.
* provide missing member functions from control_t in base_control_t * construction of control_t from reference of base_control_t instead of value. * overload operator+ for all permutations between control_t and base_control_t.
1 parent df3e3b2 commit 85bce14

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

features/frameworks/utest/utest/utest_types.h

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ namespace v1 {
128128
struct base_control_t {
129129
repeat_t repeat;
130130
uint32_t timeout;
131+
132+
repeat_t inline get_repeat() const {
133+
return repeat;
134+
}
135+
uint32_t inline get_timeout() const {
136+
return timeout;
137+
}
131138
};
132139

133140
/** Control class for specifying test case attributes
@@ -171,7 +178,7 @@ namespace v1 {
171178
control_t(uint32_t timeout_ms) :
172179
base_control_t(make_base_control_t(REPEAT_UNDECLR, timeout_ms)) {}
173180

174-
control_t(base_control_t other) :
181+
control_t(const base_control_t& other) :
175182
base_control_t(other) {}
176183

177184
friend control_t operator+(const control_t& lhs, const control_t& rhs) {
@@ -219,6 +226,21 @@ namespace v1 {
219226
friend class Harness;
220227
};
221228

229+
/// @see operator+ in control_t
230+
inline control_t operator+(const base_control_t& lhs, const base_control_t& rhs) {
231+
return control_t(lhs) + control_t(rhs);
232+
}
233+
234+
/// @see operator+ in control_t
235+
inline control_t operator+(const base_control_t& lhs, const control_t& rhs) {
236+
return control_t(lhs) + rhs;
237+
}
238+
239+
/// @see operator+ in control_t
240+
inline control_t operator+(const control_t& lhs, const base_control_t& rhs) {
241+
return lhs + control_t(rhs);
242+
}
243+
222244
/// does not repeat this test case and immediately moves on to the next one without timeout
223245
extern const base_control_t CaseNext;
224246

0 commit comments

Comments
 (0)