libamxc  1.10.3
C Generic Data Containers
test_issue_58.c File Reference
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <inttypes.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <cmocka.h>
#include <amxc/amxc.h>
#include "test_issue_58.h"

Go to the source code of this file.

Macros

#define UNUSED   __attribute__((unused))
 

Functions

int test_var_path_setup (__attribute__((unused)) void **state)
 
int test_var_path_teardown (__attribute__((unused)) void **state)
 
void test_get_var_path_ignores_empty_parts (__attribute__((unused)) void **state)
 

Variables

static amxc_var_tvar = NULL
 
static amxc_var_tdevice = NULL
 
static amxc_var_tphonebook = NULL
 
static amxc_var_tcontact = NULL
 
static amxc_var_tstar = NULL
 
static amxc_var_tlastname = NULL
 

Macro Definition Documentation

◆ UNUSED

#define UNUSED   __attribute__((unused))

Definition at line 75 of file test_issue_58.c.

Function Documentation

◆ test_get_var_path_ignores_empty_parts()

void test_get_var_path_ignores_empty_parts ( __attribute__((unused)) void **  state)

Definition at line 101 of file test_issue_58.c.

101  {
102  assert_ptr_equal(GETP_ARG(var, "Device."), device);
103  assert_ptr_equal(GETP_ARG(var, "Device..."), device);
104  assert_ptr_equal(GETP_ARG(var, ""), var);
105  assert_ptr_equal(GETP_ARG(var, "."), var);
106  assert_ptr_equal(GETP_ARG(var, "Device...Phonebook."), phonebook);
107  assert_ptr_equal(GETP_ARG(var, "Device...0."), phonebook);
108 }
#define GETP_ARG(a, p)
Convenience macro for getting variant out of a composite variant by path.
Definition: amxc_variant.h:538
static amxc_var_t * var
Definition: test_issue_58.c:77
static amxc_var_t * device
Definition: test_issue_58.c:78
static amxc_var_t * phonebook
Definition: test_issue_58.c:79

◆ test_var_path_setup()

int test_var_path_setup ( __attribute__((unused)) void **  state)

Definition at line 85 of file test_issue_58.c.

85  {
86  amxc_var_new(&var);
88  device = amxc_var_add_key(amxc_htable_t, var, "Device", NULL);
89  phonebook = amxc_var_add_key(amxc_htable_t, device, "Phonebook", NULL);
90  contact = amxc_var_add_key(amxc_htable_t, phonebook, "Contact", NULL);
92  lastname = amxc_var_add_key(amxc_htable_t, star, "LastName", NULL);
93  return 0;
94 }
#define AMXC_VAR_ID_HTABLE
Ambiorix Hash Table variant id.
Definition: amxc_variant.h:212
#define amxc_var_add_key(type, var, key, data)
Convenience macro for adding a variant to composite variant type.
Definition: amxc_variant.h:627
int amxc_var_set_type(amxc_var_t *const var, const uint32_t type)
Change the variant data type.
Definition: amxc_variant.c:261
int amxc_var_new(amxc_var_t **var)
Allocates a variant and initializes it to the null variant type.
Definition: amxc_variant.c:194
The hash table structure.
Definition: amxc_htable.h:175
static amxc_var_t * lastname
Definition: test_issue_58.c:82
static amxc_var_t * contact
Definition: test_issue_58.c:80
static amxc_var_t * star
Definition: test_issue_58.c:81

◆ test_var_path_teardown()

int test_var_path_teardown ( __attribute__((unused)) void **  state)

Definition at line 96 of file test_issue_58.c.

96  {
98  return 0;
99 }
void amxc_var_delete(amxc_var_t **var)
Frees the previously allocated variant.
Definition: amxc_variant.c:207

Variable Documentation

◆ contact

amxc_var_t* contact = NULL
static

Definition at line 80 of file test_issue_58.c.

◆ device

amxc_var_t* device = NULL
static

Definition at line 78 of file test_issue_58.c.

◆ lastname

amxc_var_t* lastname = NULL
static

Definition at line 82 of file test_issue_58.c.

◆ phonebook

amxc_var_t* phonebook = NULL
static

Definition at line 79 of file test_issue_58.c.

◆ star

amxc_var_t* star = NULL
static

Definition at line 81 of file test_issue_58.c.

◆ var

amxc_var_t* var = NULL
static

Definition at line 77 of file test_issue_58.c.