#include <sys/signalfd.h>
#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <fcntl.h>
#include <cmocka.h>
#include <amxc/amxc_macros.h>
#include <amxc/amxc.h>
#include <amxp/amxp_expression.h>
#include "../../include_priv/amxp_expr_priv.h"
#include "test_expression_node.h"
Go to the source code of this file.
◆ test_node_tree_and()
void test_node_tree_and |
( |
UNUSED void ** |
state | ) |
|
Definition at line 74 of file test_expression_node.c.
78 amxc_var_t* b1 = NULL;
79 amxc_var_t* b2 = NULL;
93 amxc_var_set(
bool, b1,
true);
94 amxc_var_set(
bool, b2,
true);
101 amxc_var_set(
bool, b1,
false);
105 amxc_var_set(
bool, b1,
true);
106 amxc_var_set(
bool, b2,
false);
PRIVATE void amxp_expr_node_new(amxp_expr_node_t **node, amxp_expr_node_type_t type)
PRIVATE void amxp_expr_node_set_left(amxp_expr_node_t *node, amxp_expr_node_t *left)
PRIVATE void amxp_expr_node_set_right(amxp_expr_node_t *node, amxp_expr_node_t *right)
PRIVATE void amxp_expr_node_delete(amxp_expr_node_t **node)
PRIVATE void amxp_expr_node_set_value(amxp_expr_node_t *node, amxc_var_t *value)
PRIVATE bool amxp_expr_node_eval(amxp_expr_t *expr, amxp_expr_node_t *node)
void amxp_expr_clean(amxp_expr_t *expr)
Clean-up the expression structure.
amxp_expr_status_t amxp_expr_init(amxp_expr_t *expr, const char *expression)
Initializes an expression structure.
◆ test_node_tree_bool_func()
void test_node_tree_bool_func |
( |
UNUSED void ** |
state | ) |
|
Definition at line 337 of file test_expression_node.c.
341 amxc_var_t* data = NULL;
342 amxc_var_t* list = NULL;
345 amxc_var_set_type(data, AMXC_VAR_ID_HTABLE);
346 list = amxc_var_add_key(amxc_llist_t, data,
"list", NULL);
349 expression.
priv = data;
361 amxc_var_add(cstring_t, list,
"123");
367 amxc_var_delete(&data);
PRIVATE void amxp_expr_node_set_field(amxp_expr_node_t *node, char *field)
PRIVATE void amxp_expr_node_set_function(amxp_expr_node_t *node, char *func_name)
PRIVATE void amxp_expr_node_add_value(amxp_expr_node_t *node, amxp_expr_node_t *value)
amxp_expr_status_t amxp_expr_get_field_var(amxp_expr_t *expr, amxc_var_t *value, const char *path, void *priv)
Variant field fetcher implementation.
amxp_expr_get_field_t get_field
◆ test_node_tree_compop()
void test_node_tree_compop |
( |
UNUSED void ** |
state | ) |
|
Definition at line 186 of file test_expression_node.c.
190 amxc_var_t* b1 = NULL;
191 amxc_var_t* b2 = NULL;
205 amxc_var_set(int32_t, b1, 1);
206 amxc_var_set(int32_t, b2, 10);
PRIVATE void amxp_expr_node_set_compop(amxp_expr_node_t *node, amxp_expr_comp_t comop)
@ amxp_expr_comp_not_equal
◆ test_node_tree_field()
void test_node_tree_field |
( |
UNUSED void ** |
state | ) |
|
Definition at line 230 of file test_expression_node.c.
234 amxc_var_t* b1 = NULL;
235 amxc_var_t* b2 = NULL;
236 amxc_var_t* t = NULL;
243 expression.
priv = b1;
252 amxc_var_set_type(b1, AMXC_VAR_ID_HTABLE);
253 t = amxc_var_add_key(amxc_htable_t, b1,
"test", NULL);
254 amxc_var_add_key(int32_t, t,
"value", 1);
255 amxc_var_set(int32_t, b2, 10);
277 amxc_var_delete(&b1);
◆ test_node_tree_not()
void test_node_tree_not |
( |
UNUSED void ** |
state | ) |
|
Definition at line 158 of file test_expression_node.c.
161 amxc_var_t* b1 = NULL;
172 amxc_var_set(
bool, b1,
true);
178 amxc_var_set(
bool, b1,
false);
◆ test_node_tree_or()
void test_node_tree_or |
( |
UNUSED void ** |
state | ) |
|
Definition at line 114 of file test_expression_node.c.
118 amxc_var_t* b1 = NULL;
119 amxc_var_t* b2 = NULL;
133 amxc_var_set(
bool, b1,
true);
134 amxc_var_set(
bool, b2,
true);
141 amxc_var_set(
bool, b1,
false);
145 amxc_var_set(
bool, b1,
true);
146 amxc_var_set(
bool, b2,
false);
150 amxc_var_set(
bool, b1,
false);
◆ test_node_tree_value_func()
void test_node_tree_value_func |
( |
UNUSED void ** |
state | ) |
|
Definition at line 370 of file test_expression_node.c.
376 amxc_var_t* data = NULL;
377 amxc_var_t* number = NULL;
380 amxc_var_set_type(data, AMXC_VAR_ID_HTABLE);
381 amxc_var_add_key(int32_t, data,
"key1", 10);
384 expression.
priv = data;
395 amxc_var_new(&number);
396 amxc_var_set(int32_t, number, 10);
412 amxc_var_delete(&data);
◆ test_node_tree_value_list()
void test_node_tree_value_list |
( |
UNUSED void ** |
state | ) |
|
Definition at line 281 of file test_expression_node.c.
288 amxc_var_t* b1 = NULL;
289 amxc_var_t* b2 = NULL;
300 amxc_var_set(int32_t, b1, 1);
305 amxc_var_set(int32_t, b2, 1);
311 amxc_var_set(int32_t, b2, 2);
317 amxc_var_set(int32_t, b2, 3);
325 amxc_var_set(int32_t, b1, 10);
329 amxc_var_set(int32_t, b1, 3);