56 #include <sys/resource.h>
84 amxc_var_set(
cstring_t, &
string,
"Key1:Hello,Key2:world,Key3:and,Key4:anyone,Key5:else,Key6:in,Key7:the,Key8:universe");
91 assert_string_equal(key_part->
data.s,
"the");
93 assert_ptr_equal(key_part, NULL);
97 assert_string_equal(key_part_const->
data.s,
"in");
100 assert_ptr_equal(key_part, NULL);
103 assert_ptr_equal(key_part, NULL);
124 amxc_var_set(
cstring_t, &
string,
"Key1:Hello,Key2:world,Key3:and,Key4:anyone,Key5:else,Key6:in,Key7:the,Key8:universe");
140 assert_string_equal(key_part_copy->
data.s,
"some text");
146 assert_string_equal(key_part_copy->
data.s,
"some text");
147 assert_ptr_equal(key_part, key_part_copy);
170 assert_int_equal(key_part_copy->
data.ui64, 123);
Ambiorix variant API header file.
#define cstring_t
Convenience macro.
AMXC_INLINE size_t amxc_htable_size(const amxc_htable_t *const htable)
Calculates the size of the hash table.
#define AMXC_VAR_FLAG_DEFAULT
The default flag, do not copy, use variant as is.
#define AMXC_VAR_FLAG_COPY
Copy the variant, creates a new variant, leaves the source variant untouched.
#define AMXC_VAR_FLAG_UPDATE
Replaces the value of the variant, leaves the source variant untouched.
#define AMXC_VAR_ID_NULL
Null variant type id (aka void)
#define AMXC_VAR_ID_CSTRING
C-string variant id (aka char *), null terminated string.
#define AMXC_VAR_ID_UINT64
Unsigned 64 bit integer variant id.
#define AMXC_VAR_ID_BOOL
Boolean variant id.
#define AMXC_VAR_ID_HTABLE
Ambiorix Hash Table variant id.
uint32_t amxc_var_type_of(const amxc_var_t *const var)
Gets the variant type id of a variant.
int amxc_var_set_type(amxc_var_t *const var, const uint32_t type)
Change the variant data type.
amxc_var_t * amxc_var_get_key(const amxc_var_t *const var, const char *const key, const int flags)
Get a reference to a part of composed variant using a key.
int amxc_var_new(amxc_var_t **var)
Allocates a variant and initializes it to the null variant type.
int amxc_var_init(amxc_var_t *const var)
Initializes a variant.
void amxc_var_clean(amxc_var_t *const var)
Clean-up and reset variant.
void amxc_var_delete(amxc_var_t **var)
Frees the previously allocated variant.
int amxc_var_set_key(amxc_var_t *const var, const char *const key, amxc_var_t *data, const int flags)
Sets a part of composed variant using a key.
#define amxc_var_set(type, var, data)
Convenience macro for setting a value in a variant.
int amxc_var_convert(amxc_var_t *const dest, const amxc_var_t *src, const uint32_t type_id)
Converts one variant (source) to another variant(destination) using the specified variant type id.
The variant struct definition.
void test_variant_htable_get_key(UNUSED void **state)
void test_variant_htable_set_key(UNUSED void **state)