Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/tests/test_macros.h
9887 views
1
/**************************************************************************/
2
/* test_macros.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
29
/**************************************************************************/
30
31
#pragma once
32
33
#include "display_server_mock.h"
34
35
#include "core/core_globals.h"
36
#include "core/input/input_map.h"
37
#include "core/object/message_queue.h"
38
#include "core/variant/variant.h"
39
40
// See documentation for doctest at:
41
// https://github.com/onqtam/doctest/blob/master/doc/markdown/readme.md#reference
42
#include "thirdparty/doctest/doctest.h"
43
44
// The test is skipped with this, run pending tests with `--test --no-skip`.
45
#define TEST_CASE_PENDING(name) TEST_CASE(name *doctest::skip())
46
47
// The test case is marked as failed, but does not fail the entire test run.
48
#define TEST_CASE_MAY_FAIL(name) TEST_CASE(name *doctest::may_fail())
49
50
// Provide aliases to conform with Godot naming conventions (see error macros).
51
#define TEST_COND(cond, ...) DOCTEST_CHECK_FALSE_MESSAGE(cond, __VA_ARGS__)
52
#define TEST_FAIL(cond, ...) DOCTEST_FAIL(cond, __VA_ARGS__)
53
#define TEST_FAIL_COND(cond, ...) DOCTEST_REQUIRE_FALSE_MESSAGE(cond, __VA_ARGS__)
54
#define TEST_FAIL_COND_WARN(cond, ...) DOCTEST_WARN_FALSE_MESSAGE(cond, __VA_ARGS__)
55
56
// Temporarily disable error prints to test failure paths.
57
// This allows to avoid polluting the test summary with error messages.
58
// The `print_error_enabled` boolean is defined in `core/core_globals.cpp` and
59
// works at global scope. It's used by various loggers in `should_log()` method,
60
// which are used by error macros which call into `OS::print_error`, effectively
61
// disabling any error messages to be printed from the engine side (not tests).
62
#define ERR_PRINT_OFF CoreGlobals::print_error_enabled = false;
63
#define ERR_PRINT_ON CoreGlobals::print_error_enabled = true;
64
65
// Stringify all `Variant` compatible types for doctest output by default.
66
// https://github.com/onqtam/doctest/blob/master/doc/markdown/stringification.md
67
68
#define DOCTEST_STRINGIFY_VARIANT(m_type) \
69
template <> \
70
struct doctest::StringMaker<m_type> { \
71
static doctest::String convert(const m_type &p_val) { \
72
const Variant val = p_val; \
73
return val.operator ::String().utf8().get_data(); \
74
} \
75
};
76
77
#define DOCTEST_STRINGIFY_VARIANT_POINTER(m_type) \
78
template <> \
79
struct doctest::StringMaker<m_type> { \
80
static doctest::String convert(const m_type *p_val) { \
81
const Variant val = p_val; \
82
return val.operator ::String().utf8().get_data(); \
83
} \
84
};
85
86
DOCTEST_STRINGIFY_VARIANT(Variant);
87
DOCTEST_STRINGIFY_VARIANT(::String); // Disambiguate from `doctest::String`.
88
89
DOCTEST_STRINGIFY_VARIANT(Vector2);
90
DOCTEST_STRINGIFY_VARIANT(Vector2i);
91
DOCTEST_STRINGIFY_VARIANT(Rect2);
92
DOCTEST_STRINGIFY_VARIANT(Rect2i);
93
DOCTEST_STRINGIFY_VARIANT(Vector3);
94
DOCTEST_STRINGIFY_VARIANT(Vector3i);
95
DOCTEST_STRINGIFY_VARIANT(Vector4);
96
DOCTEST_STRINGIFY_VARIANT(Vector4i);
97
DOCTEST_STRINGIFY_VARIANT(Transform2D);
98
DOCTEST_STRINGIFY_VARIANT(Plane);
99
DOCTEST_STRINGIFY_VARIANT(Projection);
100
DOCTEST_STRINGIFY_VARIANT(Quaternion);
101
DOCTEST_STRINGIFY_VARIANT(AABB);
102
DOCTEST_STRINGIFY_VARIANT(Basis);
103
DOCTEST_STRINGIFY_VARIANT(Transform3D);
104
105
DOCTEST_STRINGIFY_VARIANT(::Color); // Disambiguate from `doctest::Color`.
106
DOCTEST_STRINGIFY_VARIANT(StringName);
107
DOCTEST_STRINGIFY_VARIANT(NodePath);
108
DOCTEST_STRINGIFY_VARIANT(RID);
109
DOCTEST_STRINGIFY_VARIANT_POINTER(Object);
110
DOCTEST_STRINGIFY_VARIANT(Callable);
111
DOCTEST_STRINGIFY_VARIANT(Signal);
112
DOCTEST_STRINGIFY_VARIANT(Dictionary);
113
DOCTEST_STRINGIFY_VARIANT(Array);
114
115
DOCTEST_STRINGIFY_VARIANT(PackedByteArray);
116
DOCTEST_STRINGIFY_VARIANT(PackedInt32Array);
117
DOCTEST_STRINGIFY_VARIANT(PackedInt64Array);
118
DOCTEST_STRINGIFY_VARIANT(PackedFloat32Array);
119
DOCTEST_STRINGIFY_VARIANT(PackedFloat64Array);
120
DOCTEST_STRINGIFY_VARIANT(PackedStringArray);
121
DOCTEST_STRINGIFY_VARIANT(PackedVector2Array);
122
DOCTEST_STRINGIFY_VARIANT(PackedVector3Array);
123
DOCTEST_STRINGIFY_VARIANT(PackedColorArray);
124
DOCTEST_STRINGIFY_VARIANT(PackedVector4Array);
125
126
// Register test commands to be launched from the command-line.
127
// For instance: REGISTER_TEST_COMMAND("gdscript-parser" &test_parser_func).
128
// Example usage: `godot --test gdscript-parser`.
129
130
typedef void (*TestFunc)();
131
extern HashMap<String, TestFunc> *test_commands;
132
int register_test_command(String p_command, TestFunc p_function);
133
134
#define REGISTER_TEST_COMMAND(m_command, m_function) \
135
DOCTEST_GLOBAL_NO_WARNINGS(DOCTEST_ANONYMOUS(DOCTEST_ANON_VAR_), \
136
register_test_command(m_command, m_function))
137
138
// Utility macros to send an event actions to a given object
139
// Requires Message Queue and InputMap to be setup.
140
// SEND_GUI_ACTION - takes an input map key. e.g SEND_GUI_ACTION("ui_text_newline").
141
// SEND_GUI_KEY_EVENT - takes a keycode set. e.g SEND_GUI_KEY_EVENT(Key::A | KeyModifierMask::META).
142
// SEND_GUI_KEY_UP_EVENT - takes a keycode set. e.g SEND_GUI_KEY_UP_EVENT(Key::A | KeyModifierMask::META).
143
// SEND_GUI_MOUSE_BUTTON_EVENT - takes a position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_EVENT(Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None);
144
// SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT - takes a position, mouse button, mouse mask and modifiers e.g SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(Vector2(50, 50), MOUSE_BUTTON_NONE, MOUSE_BUTTON_NONE, Key::None);
145
// SEND_GUI_MOUSE_MOTION_EVENT - takes a position, mouse mask and modifiers e.g SEND_GUI_MOUSE_MOTION_EVENT(Vector2(50, 50), MouseButtonMask::LEFT, KeyModifierMask::META);
146
// SEND_GUI_DOUBLE_CLICK - takes a position and modifiers. e.g SEND_GUI_DOUBLE_CLICK(Vector2(50, 50), KeyModifierMask::META);
147
148
#define _SEND_DISPLAYSERVER_EVENT(m_event) ((DisplayServerMock *)(DisplayServer::get_singleton()))->simulate_event(m_event);
149
150
#define SEND_GUI_ACTION(m_action) \
151
{ \
152
const List<Ref<InputEvent>> *events = InputMap::get_singleton()->action_get_events(m_action); \
153
const List<Ref<InputEvent>>::Element *first_event = events->front(); \
154
Ref<InputEventKey> event = first_event->get()->duplicate(); \
155
event->set_pressed(true); \
156
_SEND_DISPLAYSERVER_EVENT(event); \
157
MessageQueue::get_singleton()->flush(); \
158
}
159
160
#define SEND_GUI_KEY_EVENT(m_input) \
161
{ \
162
Ref<InputEventKey> event = InputEventKey::create_reference(m_input); \
163
event->set_pressed(true); \
164
_SEND_DISPLAYSERVER_EVENT(event); \
165
MessageQueue::get_singleton()->flush(); \
166
}
167
168
#define SEND_GUI_KEY_UP_EVENT(m_input) \
169
{ \
170
Ref<InputEventKey> event = InputEventKey::create_reference(m_input); \
171
event->set_pressed(false); \
172
_SEND_DISPLAYSERVER_EVENT(event); \
173
MessageQueue::get_singleton()->flush(); \
174
}
175
176
#define _UPDATE_EVENT_MODIFIERS(m_event, m_modifiers) \
177
m_event->set_shift_pressed(((m_modifiers) & KeyModifierMask::SHIFT) != Key::NONE); \
178
m_event->set_alt_pressed(((m_modifiers) & KeyModifierMask::ALT) != Key::NONE); \
179
m_event->set_ctrl_pressed(((m_modifiers) & KeyModifierMask::CTRL) != Key::NONE); \
180
m_event->set_meta_pressed(((m_modifiers) & KeyModifierMask::META) != Key::NONE);
181
182
#define _CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifiers) \
183
Ref<InputEventMouseButton> event; \
184
event.instantiate(); \
185
event->set_position(m_screen_pos); \
186
event->set_button_index(m_input); \
187
event->set_button_mask(m_mask); \
188
event->set_factor(1); \
189
_UPDATE_EVENT_MODIFIERS(event, m_modifiers); \
190
event->set_pressed(true);
191
192
#define _CREATE_GUI_TOUCH_EVENT(m_screen_pos, m_pressed, m_double) \
193
Ref<InputEventScreenTouch> event; \
194
event.instantiate(); \
195
event->set_position(m_screen_pos); \
196
event->set_pressed(m_pressed); \
197
event->set_double_tap(m_double);
198
199
#define SEND_GUI_MOUSE_BUTTON_EVENT(m_screen_pos, m_input, m_mask, m_modifiers) \
200
{ \
201
_CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifiers); \
202
_SEND_DISPLAYSERVER_EVENT(event); \
203
MessageQueue::get_singleton()->flush(); \
204
}
205
206
#define SEND_GUI_MOUSE_BUTTON_RELEASED_EVENT(m_screen_pos, m_input, m_mask, m_modifiers) \
207
{ \
208
_CREATE_GUI_MOUSE_EVENT(m_screen_pos, m_input, m_mask, m_modifiers); \
209
event->set_pressed(false); \
210
_SEND_DISPLAYSERVER_EVENT(event); \
211
MessageQueue::get_singleton()->flush(); \
212
}
213
214
#define SEND_GUI_DOUBLE_CLICK(m_screen_pos, m_modifiers) \
215
{ \
216
_CREATE_GUI_MOUSE_EVENT(m_screen_pos, MouseButton::LEFT, MouseButtonMask::NONE, m_modifiers); \
217
event->set_double_click(true); \
218
_SEND_DISPLAYSERVER_EVENT(event); \
219
MessageQueue::get_singleton()->flush(); \
220
}
221
222
// We toggle _print_error_enabled to prevent display server not supported warnings.
223
#define SEND_GUI_MOUSE_MOTION_EVENT(m_screen_pos, m_mask, m_modifiers) \
224
{ \
225
bool errors_enabled = CoreGlobals::print_error_enabled; \
226
CoreGlobals::print_error_enabled = false; \
227
Ref<InputEventMouseMotion> event; \
228
event.instantiate(); \
229
event->set_position(m_screen_pos); \
230
event->set_button_mask(m_mask); \
231
_UPDATE_EVENT_MODIFIERS(event, m_modifiers); \
232
_SEND_DISPLAYSERVER_EVENT(event); \
233
MessageQueue::get_singleton()->flush(); \
234
CoreGlobals::print_error_enabled = errors_enabled; \
235
}
236
237
#define SEND_GUI_TOUCH_EVENT(m_screen_pos, m_pressed, m_double) \
238
{ \
239
_CREATE_GUI_TOUCH_EVENT(m_screen_pos, m_pressed, m_double) \
240
_SEND_DISPLAYSERVER_EVENT(event); \
241
MessageQueue::get_singleton()->flush(); \
242
}
243
244
// Utility class / macros for testing signals
245
//
246
// Use SIGNAL_WATCH(*object, "signal_name") to start watching
247
// Makes sure to call SIGNAL_UNWATCH(*object, "signal_name") to stop watching in cleanup, this is not done automatically.
248
//
249
// The SignalWatcher will capture all signals and their args sent between checks.
250
//
251
// Use SIGNAL_CHECK("signal_name"), Vector<Vector<Variant>>), to check the arguments of all fired signals.
252
// The outer vector is each fired signal, the inner vector the list of arguments for that signal. Order does matter.
253
//
254
// Use SIGNAL_CHECK_FALSE("signal_name") to check if a signal was not fired.
255
//
256
// Use SIGNAL_DISCARD("signal_name") to discard records all of the given signal, use only in placed you don't need to check.
257
//
258
// All signals are automatically discarded between test/sub test cases.
259
260
class SignalWatcher : public Object {
261
private:
262
inline static SignalWatcher *singleton;
263
264
/* Equal to: RBMap<String, Vector<Vector<Variant>>> */
265
HashMap<String, Array> _signals;
266
void _add_signal_entry(const Array &p_args, const String &p_name) {
267
if (!_signals.has(p_name)) {
268
_signals[p_name] = Array();
269
}
270
_signals[p_name].push_back(p_args);
271
}
272
273
void _signal_callback_zero(const String &p_name) {
274
Array args;
275
_add_signal_entry(args, p_name);
276
}
277
278
void _signal_callback_one(Variant p_arg1, const String &p_name) {
279
Array args = { p_arg1 };
280
_add_signal_entry(args, p_name);
281
}
282
283
void _signal_callback_two(Variant p_arg1, Variant p_arg2, const String &p_name) {
284
Array args = { p_arg1, p_arg2 };
285
_add_signal_entry(args, p_name);
286
}
287
288
void _signal_callback_three(Variant p_arg1, Variant p_arg2, Variant p_arg3, const String &p_name) {
289
Array args = { p_arg1, p_arg2, p_arg3 };
290
_add_signal_entry(args, p_name);
291
}
292
293
public:
294
static SignalWatcher *get_singleton() { return singleton; }
295
296
void watch_signal(Object *p_object, const String &p_signal) {
297
MethodInfo method_info;
298
ClassDB::get_signal(p_object->get_class(), p_signal, &method_info);
299
switch (method_info.arguments.size()) {
300
case 0: {
301
p_object->connect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_zero).bind(p_signal));
302
} break;
303
case 1: {
304
p_object->connect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_one).bind(p_signal));
305
} break;
306
case 2: {
307
p_object->connect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_two).bind(p_signal));
308
} break;
309
case 3: {
310
p_object->connect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_three).bind(p_signal));
311
} break;
312
default: {
313
MESSAGE("Signal ", p_signal, " arg count not supported.");
314
} break;
315
}
316
}
317
318
void unwatch_signal(Object *p_object, const String &p_signal) {
319
MethodInfo method_info;
320
ClassDB::get_signal(p_object->get_class(), p_signal, &method_info);
321
switch (method_info.arguments.size()) {
322
case 0: {
323
p_object->disconnect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_zero));
324
} break;
325
case 1: {
326
p_object->disconnect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_one));
327
} break;
328
case 2: {
329
p_object->disconnect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_two));
330
} break;
331
case 3: {
332
p_object->disconnect(p_signal, callable_mp(this, &SignalWatcher::_signal_callback_three));
333
} break;
334
default: {
335
MESSAGE("Signal ", p_signal, " arg count not supported.");
336
} break;
337
}
338
}
339
340
bool check(const String &p_name, const Array &p_args) {
341
if (!_signals.has(p_name)) {
342
MESSAGE("Signal ", p_name, " not emitted");
343
return false;
344
}
345
346
if (p_args.size() != _signals[p_name].size()) {
347
MESSAGE("Signal has " << _signals[p_name] << " expected " << p_args);
348
discard_signal(p_name);
349
return false;
350
}
351
352
bool match = true;
353
for (int i = 0; i < p_args.size(); i++) {
354
if (((Array)p_args[i]).size() != ((Array)_signals[p_name][i]).size()) {
355
MESSAGE("Signal has " << _signals[p_name][i] << " expected " << p_args[i]);
356
match = false;
357
continue;
358
}
359
360
for (int j = 0; j < ((Array)p_args[i]).size(); j++) {
361
if (((Array)p_args[i])[j] != ((Array)_signals[p_name][i])[j]) {
362
MESSAGE("Signal has " << _signals[p_name][i] << " expected " << p_args[i]);
363
match = false;
364
break;
365
}
366
}
367
}
368
369
discard_signal(p_name);
370
return match;
371
}
372
373
bool check_false(const String &p_name) {
374
bool has = _signals.has(p_name);
375
if (has) {
376
MESSAGE("Signal has " << _signals[p_name] << " expected none.");
377
}
378
discard_signal(p_name);
379
return !has;
380
}
381
382
void discard_signal(const String &p_name) {
383
if (_signals.has(p_name)) {
384
_signals.erase(p_name);
385
}
386
}
387
388
void _clear_signals() {
389
_signals.clear();
390
}
391
392
SignalWatcher() {
393
singleton = this;
394
}
395
396
~SignalWatcher() {
397
singleton = nullptr;
398
}
399
};
400
401
#define SIGNAL_WATCH(m_object, m_signal) SignalWatcher::get_singleton()->watch_signal(m_object, m_signal);
402
#define SIGNAL_UNWATCH(m_object, m_signal) SignalWatcher::get_singleton()->unwatch_signal(m_object, m_signal);
403
404
#define SIGNAL_CHECK(m_signal, m_args) CHECK(SignalWatcher::get_singleton()->check(m_signal, m_args));
405
#define SIGNAL_CHECK_FALSE(m_signal) CHECK(SignalWatcher::get_singleton()->check_false(m_signal));
406
#define SIGNAL_DISCARD(m_signal) SignalWatcher::get_singleton()->discard_signal(m_signal);
407
408
#define MULTICHECK_STRING_EQ(m_obj, m_func, m_param1, m_eq) \
409
CHECK(m_obj.m_func(m_param1) == m_eq); \
410
CHECK(m_obj.m_func(U##m_param1) == m_eq); \
411
CHECK(m_obj.m_func(L##m_param1) == m_eq); \
412
CHECK(m_obj.m_func(String(m_param1)) == m_eq);
413
414
#define MULTICHECK_STRING_INT_EQ(m_obj, m_func, m_param1, m_param2, m_eq) \
415
CHECK(m_obj.m_func(m_param1, m_param2) == m_eq); \
416
CHECK(m_obj.m_func(U##m_param1, m_param2) == m_eq); \
417
CHECK(m_obj.m_func(L##m_param1, m_param2) == m_eq); \
418
CHECK(m_obj.m_func(String(m_param1), m_param2) == m_eq);
419
420
#define MULTICHECK_STRING_INT_INT_EQ(m_obj, m_func, m_param1, m_param2, m_param3, m_eq) \
421
CHECK(m_obj.m_func(m_param1, m_param2, m_param3) == m_eq); \
422
CHECK(m_obj.m_func(U##m_param1, m_param2, m_param3) == m_eq); \
423
CHECK(m_obj.m_func(L##m_param1, m_param2, m_param3) == m_eq); \
424
CHECK(m_obj.m_func(String(m_param1), m_param2, m_param3) == m_eq);
425
426
#define MULTICHECK_STRING_STRING_EQ(m_obj, m_func, m_param1, m_param2, m_eq) \
427
CHECK(m_obj.m_func(m_param1, m_param2) == m_eq); \
428
CHECK(m_obj.m_func(U##m_param1, U##m_param2) == m_eq); \
429
CHECK(m_obj.m_func(L##m_param1, L##m_param2) == m_eq); \
430
CHECK(m_obj.m_func(String(m_param1), String(m_param2)) == m_eq);
431
432
#define MULTICHECK_GET_SLICE(m_obj, m_param1, m_slices) \
433
for (int i = 0; i < m_obj.get_slice_count(m_param1); ++i) { \
434
CHECK(m_obj.get_slice(m_param1, i) == m_slices[i]); \
435
} \
436
for (int i = 0; i < m_obj.get_slice_count(U##m_param1); ++i) { \
437
CHECK(m_obj.get_slice(U##m_param1, i) == m_slices[i]); \
438
} \
439
for (int i = 0; i < m_obj.get_slice_count(L##m_param1); ++i) { \
440
CHECK(m_obj.get_slice(L##m_param1, i) == m_slices[i]); \
441
} \
442
for (int i = 0; i < m_obj.get_slice_count(String(m_param1)); ++i) { \
443
CHECK(m_obj.get_slice(String(m_param1), i) == m_slices[i]); \
444
}
445
446
#define MULTICHECK_SPLIT(m_obj, m_func, m_param1, m_param2, m_param3, m_slices, m_expected_size) \
447
do { \
448
Vector<String> string_list; \
449
\
450
string_list = m_obj.m_func(m_param1, m_param2, m_param3); \
451
CHECK(m_expected_size == string_list.size()); \
452
for (int i = 0; i < string_list.size(); ++i) { \
453
CHECK(string_list[i] == m_slices[i]); \
454
} \
455
\
456
string_list = m_obj.m_func(U##m_param1, m_param2, m_param3); \
457
CHECK(m_expected_size == string_list.size()); \
458
for (int i = 0; i < string_list.size(); ++i) { \
459
CHECK(string_list[i] == m_slices[i]); \
460
} \
461
\
462
string_list = m_obj.m_func(L##m_param1, m_param2, m_param3); \
463
CHECK(m_expected_size == string_list.size()); \
464
for (int i = 0; i < string_list.size(); ++i) { \
465
CHECK(string_list[i] == m_slices[i]); \
466
} \
467
\
468
string_list = m_obj.m_func(String(m_param1), m_param2, m_param3); \
469
CHECK(m_expected_size == string_list.size()); \
470
for (int i = 0; i < string_list.size(); ++i) { \
471
CHECK(string_list[i] == m_slices[i]); \
472
} \
473
} while (false)
474
475