250 bool key_path =
false;
251 amxc_llist_init(&paths);
253 assert_int_equal(
amxd_object_resolve_pathf(root_obj, &paths,
"RootObject.TemplateObject.[ChildObject.Param1=='sub-test1']"), 0);
254 assert_int_equal(amxc_llist_size(&paths), 1);
255 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.1.");
256 amxc_llist_clean(&paths, amxc_string_list_it_free);
259 assert_int_equal(amxc_llist_size(&paths), 2);
260 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.4.");
261 amxc_llist_clean(&paths, amxc_string_list_it_free);
264 assert_int_equal(amxc_llist_size(&paths), 2);
265 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.4.");
266 amxc_llist_clean(&paths, amxc_string_list_it_free);
269 assert_int_equal(amxc_llist_size(&paths), 5);
270 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.1.ChildObject.");
271 amxc_llist_clean(&paths, amxc_string_list_it_free);
274 assert_int_equal(amxc_llist_size(&paths), 5);
275 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.1.ChildObject.");
276 amxc_llist_clean(&paths, amxc_string_list_it_free);
278 assert_int_equal(
amxd_dm_resolve_pathf(&
dm, &paths,
"RootObject.TemplateObject.*.ChildObject.TemplateObject.[Alias=='SubAlias']"), 0);
279 assert_int_equal(amxc_llist_size(&paths), 2);
280 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.2.ChildObject.TemplateObject.1.");
281 amxc_llist_clean(&paths, amxc_string_list_it_free);
283 assert_int_equal(
amxd_dm_resolve_pathf_ext(&
dm, &key_path, &paths,
"RootObject.TemplateObject.*.ChildObject.TemplateObject.[Alias=='SubAlias']"), 0);
284 assert_int_equal(amxc_llist_size(&paths), 2);
285 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.2.ChildObject.TemplateObject.1.");
286 amxc_llist_clean(&paths, amxc_string_list_it_free);
288 assert_int_equal(
amxd_object_resolve_pathf(root_obj, &paths,
"RootObject.TemplateObject.Alias5.ChildObject.TemplateObject.[SubAlias2]"), 0);
289 assert_int_equal(amxc_llist_size(&paths), 1);
290 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.5.ChildObject.TemplateObject.1.");
291 amxc_llist_clean(&paths, amxc_string_list_it_free);
293 assert_int_equal(
amxd_object_resolve_pathf(root_obj, &paths,
"RootObject.TemplateObject.[5].ChildObject.TemplateObject.[SubAlias2]"), 0);
294 assert_int_equal(amxc_llist_size(&paths), 1);
295 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.5.ChildObject.TemplateObject.1.");
296 amxc_llist_clean(&paths, amxc_string_list_it_free);
298 assert_int_equal(
amxd_object_resolve_pathf(root_obj, &paths,
"RootObject.TemplateObject.[ChildObject.Param3 == 240].ChildObject.TemplateObject.*"), 0);
299 assert_int_equal(amxc_llist_size(&paths), 1);
300 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.TemplateObject.5.ChildObject.TemplateObject.1.");
301 amxc_llist_clean(&paths, amxc_string_list_it_free);
305 assert_int_equal(amxc_llist_size(&paths), 1);
306 assert_string_equal(amxc_string_get(amxc_string_from_llist_it(amxc_llist_get_first(&paths)), 0),
"RootObject.");
307 amxc_llist_clean(&paths, amxc_string_list_it_free);
310 assert_int_equal(amxc_llist_size(&paths), 1);
311 amxc_llist_clean(&paths, amxc_string_list_it_free);
amxd_object_t amxd_status_t amxd_status_t amxd_dm_resolve_pathf_ext(amxd_dm_t *const dm, bool *key_path, amxc_llist_t *paths, const char *abs_path,...) __attribute__((format(printf
amxd_object_t amxd_status_t amxd_dm_resolve_pathf(amxd_dm_t *const dm, amxc_llist_t *paths, const char *abs_path,...) __attribute__((format(printf
amxd_object_t amxd_status_t amxd_status_t amxd_object_resolve_pathf_ext(amxd_object_t *object, bool *key_path, amxc_llist_t *paths, const char *rel_path,...) __attribute__((format(printf
Resolves a search path into a list of matching object paths.