64 #include <amxc/amxc.h>
65 #include <amxp/amxp_signal.h>
66 #include <amxp/amxp_slot.h>
74 #include <amxc/amxc_macros.h>
81 assert_ptr_not_equal(
object, NULL);
82 assert_string_equal(object->
name,
"test_object");
88 assert_int_equal(object->
index, 0);
89 assert_true(amxc_llist_is_empty(&object->
objects));
90 assert_true(amxc_llist_is_empty(&object->
instances));
91 assert_int_equal(amxc_llist_size(&object->
functions), 0);
94 assert_ptr_equal(object->
it.llist, NULL);
96 assert_ptr_equal(
object, NULL);
99 assert_ptr_not_equal(
object, NULL);
101 assert_ptr_equal(
object, NULL);
108 assert_ptr_not_equal(
object, NULL);
109 assert_string_equal(object->
name,
"test_object");
115 assert_int_equal(object->
index, 0);
116 assert_true(amxc_llist_is_empty(&object->
objects));
117 assert_true(amxc_llist_is_empty(&object->
instances));
118 assert_int_equal(amxc_llist_size(&object->
functions), 0);
121 assert_ptr_equal(object->
it.llist, NULL);
123 assert_ptr_equal(
object, NULL);
126 assert_ptr_not_equal(
object, NULL);
128 assert_ptr_equal(
object, NULL);
135 assert_ptr_not_equal(
object, NULL);
136 assert_string_equal(object->
name,
"test-object");
142 assert_int_equal(object->
index, 0);
143 assert_true(amxc_llist_is_empty(&object->
objects));
144 assert_true(amxc_llist_is_empty(&object->
instances));
145 assert_true(amxc_llist_is_empty(&object->
functions));
148 assert_ptr_equal(object->
it.llist, NULL);
150 assert_ptr_equal(
object, NULL);
156 assert_ptr_equal(
object, NULL);
158 assert_ptr_equal(
object, NULL);
160 assert_ptr_equal(
object, NULL);
166 assert_ptr_equal(
object, NULL);
168 assert_ptr_equal(
object, NULL);
170 assert_ptr_equal(
object, NULL);
172 assert_ptr_equal(
object, NULL);
174 assert_ptr_equal(
object, NULL);
181 assert_ptr_not_equal(
template, NULL);
184 assert_ptr_not_equal(
object, NULL);
185 assert_string_equal(object->
name,
"test_instance1");
191 assert_int_equal(object->
index, 1);
192 assert_true(amxc_llist_is_empty(&object->
objects));
193 assert_true(amxc_llist_is_empty(&object->
instances));
194 assert_true(amxc_llist_is_empty(&object->
functions));
197 assert_ptr_equal(object->
it.llist, &template->instances);
207 assert_ptr_not_equal(
template, NULL);
210 assert_int_equal(object->
index, 1);
214 assert_int_equal(object->
index, 2);
216 assert_int_equal(object->
index, 5);
218 assert_int_equal(object->
index, 6);
221 assert_ptr_equal(
object, NULL);
223 assert_ptr_equal(
object, NULL);
225 assert_ptr_equal(
object, NULL);
227 assert_ptr_equal(
object, NULL);
229 assert_ptr_equal(
object, NULL);
238 assert_ptr_not_equal(singelton, NULL);
241 assert_ptr_equal(
object, NULL);
254 assert_ptr_not_equal(
template, NULL);
258 assert_ptr_not_equal(
object, NULL);
261 assert_ptr_not_equal(
object, NULL);
264 assert_ptr_not_equal(
object, NULL);
266 assert_int_equal(amxc_llist_size(&template->objects), 3);
269 assert_ptr_not_equal(
object, NULL);
270 assert_int_equal(amxc_llist_size(&object->
objects), 3);
282 assert_ptr_not_equal(
template, NULL);
285 assert_ptr_equal(
object, NULL);
320 assert_ptr_not_equal(instance_child2, NULL);
321 assert_ptr_not_equal(instance_child2, child2);
Ambiorix Data Model API header file.
Ambiorix Data Model API header file.
#define AMXD_OBJECT_INDEXED
Name and path format flag - use index for instance objects.
#define AMXD_OBJECT_NAMED
Name and path format flag - default behavior, use name for instance objects.
amxd_object_t * amxd_dm_get_root(amxd_dm_t *const dm)
Fetches the root object of the data model.
amxd_status_t amxd_dm_add_root_object(amxd_dm_t *const dm, amxd_object_t *const object)
Adds an object to the root of the data model.
amxd_status_t amxd_dm_init(amxd_dm_t *dm)
Initializes a data model structure.
void amxd_dm_clean(amxd_dm_t *dm)
Cleans a data model structure.
amxd_object_t * amxd_object_findf(amxd_object_t *object, const char *rel_path,...) __attribute__((format(printf
Find an object in the data model tree, starting from an object.
amxd_status_t amxd_object_add_object(amxd_object_t *const parent, amxd_object_t *const child)
Adds an object in the data model tree.
amxd_status_t amxd_object_set_attr(amxd_object_t *const object, const amxd_oattr_id_t attr, const bool enable)
Sets or unsets an object attribute.
amxd_status_t amxd_object_new_instance(amxd_object_t **object, amxd_object_t *templ, const char *name, uint32_t index, amxc_var_t *values)
Data model object constructor function.
amxd_status_t amxd_object_new(amxd_object_t **object, const amxd_object_type_t type, const char *name)
Data model object constructor function.
void amxd_object_delete(amxd_object_t **object)
Invokes the destroy handler(s) of the object.
bool amxd_object_is_attr_set(const amxd_object_t *const object, const amxd_oattr_id_t attr)
Checks if an attribute is set.
const char * amxd_object_get_name(const amxd_object_t *const object, const uint32_t flags)
Get the name of the object (or index as a string for instance objects)
amxd_status_t amxd_object_set_attrs(amxd_object_t *const object, const uint32_t bitmask, bool enable)
Sets or unsets object attributes using a bitmap.
amxc_llist_t derived_objects
amxc_llist_it_t derived_from
void test_amxd_object_get_name(UNUSED void **state)
void test_amxd_object_new_instance_invalid_name_index(UNUSED void **state)
void test_amxd_object_new_invalid_type(UNUSED void **state)
void test_amxd_object_get_name_of_indexed_instance(UNUSED void **state)
void test_amxd_object_new_delete_invalid_args(UNUSED void **state)
void test_amxd_object_attributes(UNUSED void **state)
void test_amxd_object_new_invalid_name(UNUSED void **state)
void test_amxd_object_new_mib(UNUSED void **state)
void test_amxd_object_new_instance_of_singelton(UNUSED void **state)
void test_amxd_object_new_instance_with_children(UNUSED void **state)
void test_amxd_object_new_template(UNUSED void **state)
void test_amxd_object_new_instance(UNUSED void **state)
void test_amxd_object_new_singleton(UNUSED void **state)