#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <unistd.h>
#include <amxc/amxc_variant.h>
#include <amxc_variant_priv.h>
#include "test_variant_timestamp.h"
#include <amxc/amxc_macros.h>
Go to the source code of this file.
◆ test_variant_ts_add_to_composite_types()
void test_variant_ts_add_to_composite_types |
( |
UNUSED void ** |
state | ) |
|
Definition at line 250 of file test_variant_timestamp.c.
int amxc_ts_now(amxc_ts_t *tsp)
Takes current time as unix epoch time.
#define AMXC_VAR_ID_LIST
Ambiorix Linked List variant id.
#define AMXC_VAR_ID_HTABLE
Ambiorix Hash Table variant id.
#define amxc_var_add_key(type, var, key, data)
Convenience macro for adding a variant to composite variant type.
#define amxc_var_add(type, var, data)
Convenience macro for adding a variant to composite variant type.
int amxc_var_set_type(amxc_var_t *const var, const uint32_t type)
Change the variant data 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.
The variant struct definition.
The timestamp structure (unix epoch time).
◆ test_variant_ts_compare()
void test_variant_ts_compare |
( |
UNUSED void ** |
state | ) |
|
Definition at line 190 of file test_variant_timestamp.c.
205 assert_true(result == 0);
207 assert_true(result > 0);
209 assert_true(result < 0);
#define cstring_t
Convenience macro.
#define AMXC_VAR_ID_TIMESTAMP
Ambiorix timestamp variant id.
#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.
int amxc_var_compare(const amxc_var_t *const var1, const amxc_var_t *const var2, int *const result)
Compares two variants.
◆ test_variant_ts_convert_to_any()
void test_variant_ts_convert_to_any |
( |
UNUSED void ** |
state | ) |
|
Definition at line 170 of file test_variant_timestamp.c.
#define AMXC_VAR_ID_ANY
Special variant id, typically used in cast or conversion functions.
◆ test_variant_ts_convert_to_double()
void test_variant_ts_convert_to_double |
( |
UNUSED void ** |
state | ) |
|
◆ test_variant_ts_convert_to_int64()
void test_variant_ts_convert_to_int64 |
( |
UNUSED void ** |
state | ) |
|
◆ test_variant_ts_convert_to_other_int()
void test_variant_ts_convert_to_other_int |
( |
UNUSED void ** |
state | ) |
|
Definition at line 127 of file test_variant_timestamp.c.
#define AMXC_VAR_ID_UINT32
Unsigned 32 bit integer variant id.
#define AMXC_VAR_ID_INT16
Signed 16 bit integer variant id.
#define AMXC_VAR_ID_UINT8
Unsigned 8 bit integer variant id.
#define AMXC_VAR_ID_UINT64
Unsigned 64 bit integer variant id.
#define AMXC_VAR_ID_UINT16
Unsigned 16 bit integer variant id.
#define AMXC_VAR_ID_INT32
Signed 32 bit integer variant id.
#define AMXC_VAR_ID_INT8
Signed 8 bit integer variant id.
◆ test_variant_ts_convert_to_string()
void test_variant_ts_convert_to_string |
( |
UNUSED void ** |
state | ) |
|
Definition at line 92 of file test_variant_timestamp.c.
102 assert_string_equal(copy_var.
data.s,
"0001-01-01T00:00:00Z");
#define AMXC_VAR_ID_CSTRING
C-string variant id (aka char *), null terminated string.
int amxc_var_dump(const amxc_var_t *const var, int fd)
Dumps the content of the variant in a human readable manner.
◆ test_variant_ts_copy()
void test_variant_ts_copy |
( |
UNUSED void ** |
state | ) |
|
Definition at line 69 of file test_variant_timestamp.c.
86 assert_int_equal(copy_var.
data.ts.sec, now.
sec);
#define AMXC_VAR_ID_NULL
Null variant type id (aka void)
int amxc_var_copy(amxc_var_t *const dest, const amxc_var_t *const src)
Copy the type and data from one variant (source) in another variant (destination).
◆ test_variant_ts_get()
void test_variant_ts_get |
( |
UNUSED void ** |
state | ) |
|
Definition at line 216 of file test_variant_timestamp.c.
227 assert_ptr_not_equal(ts, NULL);
230 assert_ptr_not_equal(cts, NULL);
232 assert_ptr_equal(cts, NULL);
243 assert_ptr_equal(ts, NULL);
#define amxc_var_dyncast(type, var)
Dynamic cast a variant to a certain type.
#define amxc_var_constcast(type, var)
Takes the content from a variant.