#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 <amxp/amxp_signal.h>
#include <amxd/amxd_dm.h>
#include <amxd/amxd_object.h>
#include <amxd/amxd_parameter.h>
#include <amxo/amxo.h>
#include "test_invalid_odl.h"
#include <amxc/amxc_macros.h>
Go to the source code of this file.
◆ _print_event()
static void _print_event |
( |
const char *const |
sig_name, |
|
|
UNUSED const amxc_var_t *const |
data, |
|
|
UNUSED void *const |
priv |
|
) |
| |
|
static |
◆ test_add_inst_on_singelton()
void test_add_inst_on_singelton |
( |
UNUSED void ** |
state | ) |
|
Definition at line 175 of file test_invalid_odl.c.
179 "%define { object Test; }" \
180 "%populate { object Test { instance add(0,\"\"); } }";
int amxo_parser_parse_string(amxo_parser_t *parser, const char *text, amxd_object_t *object)
Parses a string containing a valid ODL part.
void amxo_parser_clean(amxo_parser_t *parser)
Cleans up the odl parser instance.
static amxd_status_t amxo_parser_get_status(amxo_parser_t *parser)
Get the status of the odl parser.
int amxo_parser_init(amxo_parser_t *parser)
Initializes a new odl parser instance.
The ODL parser structure.
◆ test_add_mib_with_duplicates()
void test_add_mib_with_duplicates |
( |
UNUSED void ** |
state | ) |
|
Definition at line 600 of file test_invalid_odl.c.
603 const char* odls[] = {
604 "%define { mib TestMib { string Text; } object Test { string Text; extend with mib TestMib; } }",
605 "%define { mib TestMib { string Text; } object Test { extend with mib TestMib; string Text; } }",
612 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_add_not_existing_mib()
void test_add_not_existing_mib |
( |
UNUSED void ** |
state | ) |
|
Definition at line 579 of file test_invalid_odl.c.
582 const char* odls[] = {
583 "%define { object Test { extend with mib FakeMib; } }",
590 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_dummy_action()
static amxd_status_t test_dummy_action |
( |
UNUSED amxd_object_t *const |
object, |
|
|
UNUSED amxd_param_t *const |
param, |
|
|
UNUSED amxd_action_t |
reason, |
|
|
UNUSED const amxc_var_t *const |
args, |
|
|
UNUSED amxc_var_t *const |
retval, |
|
|
UNUSED void * |
priv |
|
) |
| |
|
static |
◆ test_duplicate_func_arg_name()
void test_duplicate_func_arg_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 350 of file test_invalid_odl.c.
353 const char*
odl =
"%define { object Test { void F1(bool a1, bool a2, bool a1); } }";
◆ test_duplicate_inst_index()
void test_duplicate_inst_index |
( |
UNUSED void ** |
state | ) |
|
Definition at line 192 of file test_invalid_odl.c.
196 "%define { object Test[]; }" \
197 "%populate { object Test { instance add(1,\"\"); instance add(1,\"\"); } }";
◆ test_duplicate_inst_name()
void test_duplicate_inst_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 209 of file test_invalid_odl.c.
213 "%define { object Test[]; }" \
214 "%populate { object Test { instance add(0,\"AB\"); instance add(0,\"AB\"); } }";
◆ test_duplicate_obj_name()
void test_duplicate_obj_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 260 of file test_invalid_odl.c.
263 const char*
odl =
"%define { object Test1; object Test2; object Test1; }";
◆ test_duplicate_param_name()
void test_duplicate_param_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 290 of file test_invalid_odl.c.
293 const char*
odl =
"%define { object Test { string P1; string P2; string P1; } }";
◆ test_duplicate_param_name_with_counter()
void test_duplicate_param_name_with_counter |
( |
UNUSED void ** |
state | ) |
|
Definition at line 305 of file test_invalid_odl.c.
308 const char*
odl =
"%define { object Test { string P1; object TT[] { counted with P1; } } }";
◆ test_empty_file_name()
void test_empty_file_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 734 of file test_invalid_odl.c.
int amxo_parser_parse_file(amxo_parser_t *parser, const char *file_path, amxd_object_t *object)
Parses an odl file.
◆ test_instance_of_singleton()
void test_instance_of_singleton |
( |
UNUSED void ** |
state | ) |
|
Definition at line 243 of file test_invalid_odl.c.
247 "%define { object Test; }" \
248 "%populate { object Test { instance add(0,\"Text\"); instance add(0,\"AB\"); } }";
◆ test_invalid_action_name()
void test_invalid_action_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 438 of file test_invalid_odl.c.
446 " on action reset call dummy;"
int amxo_resolver_ftab_add(amxo_parser_t *parser, const char *fn_name, amxo_fn_ptr_t fn)
Adds a C function to the function table.
#define AMXO_FUNC(x)
Function ponter caster macro.
static amxd_status_t test_dummy_action(UNUSED amxd_object_t *const object, UNUSED amxd_param_t *const param, UNUSED amxd_action_t reason, UNUSED const amxc_var_t *const args, UNUSED amxc_var_t *const retval, UNUSED void *priv)
◆ test_invalid_func_attrs()
void test_invalid_func_attrs |
( |
UNUSED void ** |
state | ) |
|
Definition at line 148 of file test_invalid_odl.c.
151 const char* odls[] = {
152 "%define { object Test { %read-only void Func(); } }",
153 "%define { object Test { %persistent void Func(); } }",
154 "%define { object Test { %in void Func(); } }",
155 "%define { object Test { %out void Func(); } }",
156 "%define { object Test { %mandatory void Func(); } }",
157 "%define { object Test { %strict void Func(); } }",
158 "%define { object Test { %volatile void Func(); } }",
165 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_invalid_func_name()
void test_invalid_func_name |
( |
UNUSED void ** |
state | ) |
|
◆ test_invalid_inst_name()
void test_invalid_inst_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 226 of file test_invalid_odl.c.
230 "%define { object Test[]; }" \
231 "%populate { object Test { instance add(0,\"%Text$\"); instance add(0,\"AB\"); } }";
◆ test_invalid_key_params()
void test_invalid_key_params |
( |
UNUSED void ** |
state | ) |
|
Definition at line 646 of file test_invalid_odl.c.
652 " object TestRoot {\n"
654 " %key string text;\n"
659 " object TestRoot.Test {\n"
666 " object TestRoot {\n"
668 " %key string text;\n"
673 " object TestRoot.Test {\n"
674 " instance add() {\n"
675 " parameter text = \"KeyValue\";\n"
682 " object TestRoot {\n"
684 " %key string text;\n"
689 " object TestRoot.Test {\n"
690 " instance add(text = \"key1\");\n"
691 " instance add(text = \"key1\");\n"
697 " object TestRoot {\n"
699 " %key string text = \"Hallo\";\n"
707 printf(
"%s\n", odl_1);
713 printf(
"%s\n", odl_2);
719 printf(
"%s\n", odl_3);
725 printf(
"%s\n", odl_4);
◆ test_invalid_obj_name()
void test_invalid_obj_name |
( |
UNUSED void ** |
state | ) |
|
◆ test_invalid_object_action_name()
void test_invalid_object_action_name |
( |
UNUSED void ** |
state | ) |
|
◆ test_invalid_object_attrs()
void test_invalid_object_attrs |
( |
UNUSED void ** |
state | ) |
|
Definition at line 97 of file test_invalid_odl.c.
100 const char* odls[] = {
101 "%define { %in object Test; }",
102 "%define { %out object Test; }",
103 "%define { %mandatory object Test; }",
104 "%define { %strict object Test; }",
105 "%define { %volatile object Test; }",
106 "%define { %template object Test; }",
107 "%define { %instance object Test; }",
114 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_invalid_param_attrs()
void test_invalid_param_attrs |
( |
UNUSED void ** |
state | ) |
|
Definition at line 124 of file test_invalid_odl.c.
127 const char* odls[] = {
128 "%define { object Test { %in string Param; } }",
129 "%define { object Test { %out string Param; } }",
130 "%define { object Test { %mandatory string Param; } }",
131 "%define { object Test { %strict string Param; } }",
138 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_invalid_param_name()
void test_invalid_param_name |
( |
UNUSED void ** |
state | ) |
|
Definition at line 320 of file test_invalid_odl.c.
323 const char*
odl =
"%define { object Test { string \"12$P1\"; } }";
◆ test_invalid_param_value()
void test_invalid_param_value |
( |
UNUSED void ** |
state | ) |
|
Definition at line 395 of file test_invalid_odl.c.
398 const char*
odl =
"%define { object Test { bool P1;} } %populate { object Test { parameter P1 = \"text\"; } }";
399 const char* odl2 =
"%define { object Test { string P1;} } %populate { object Test { parameter P1 = [ 1, 2, 3 ]; } }";
◆ test_invalid_param_value_validate()
void test_invalid_param_value_validate |
( |
UNUSED void ** |
state | ) |
|
◆ test_invalid_parameter_actions()
void test_invalid_parameter_actions |
( |
UNUSED void ** |
state | ) |
|
Definition at line 531 of file test_invalid_odl.c.
534 const char* odls[] = {
535 "%define { object Test { string Text { on action \"list\" call dummy; } } }",
536 "%define { object Test { string Text { on action add-inst call dummy; } } }",
537 "%define { object Test { string Text { on action del-inst call dummy; } } }",
546 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_invalid_regexp_in_filter()
void test_invalid_regexp_in_filter |
( |
UNUSED void ** |
state | ) |
|
Definition at line 622 of file test_invalid_odl.c.
628 " object Test { string text = \"Hallo\"; }\n"
631 " on event \".*\" call print_event \n"
632 " filter \'object matches \"[(adsads[\"';\n"
static void _print_event(const char *const sig_name, UNUSED const amxc_var_t *const data, UNUSED void *const priv)
◆ test_invalid_resolvers()
void test_invalid_resolvers |
( |
UNUSED void ** |
state | ) |
|
Definition at line 485 of file test_invalid_odl.c.
488 const char* odls[] = {
489 "%define { object Test { void test()<!!>;} }",
490 "%define { object Test { void test()<!:!>;} }",
491 "%define { object Test { void test()<!:echo!>;} }",
492 "%define { object Test { void test()<!invalid:echo!>;} }",
493 "%define { object Test { void test()<!more!>;} }",
500 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_not_existing_entry_point()
void test_not_existing_entry_point |
( |
UNUSED void ** |
state | ) |
|
Definition at line 510 of file test_invalid_odl.c.
513 const char* odls[] = {
514 " import \"../test_plugin/test_plugin.so\" as test_plugin; %define { entry-point test_plugin.not_existing; }",
521 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_not_resolved_action()
void test_not_resolved_action |
( |
UNUSED void ** |
state | ) |
|
Definition at line 556 of file test_invalid_odl.c.
559 const char* odls[] = {
560 "%define { object Test { on action \"list\" call not_existing; } }",
561 "%define { object Test { string Text { on action read call no_existing; } } }",
562 "%define { object Test { on action write call not_existing; } }",
569 for(
int i = 0; odls[i] != NULL; i++) {
◆ test_parse_non_existing_file()
void test_parse_non_existing_file |
( |
UNUSED void ** |
state | ) |
|
Definition at line 747 of file test_invalid_odl.c.
int amxo_parser_new(amxo_parser_t **parser)
Allocates memory for a new parser instance on the heap and initializes the odl parser.
void amxo_parser_delete(amxo_parser_t **parser)
Cleans the odl parser content and frees the allocated memory.
void amxo_resolver_import_close_all(void)
Unloads all loaded shared objects.
◆ test_select_none_existing_obj()
void test_select_none_existing_obj |
( |
UNUSED void ** |
state | ) |
|
Definition at line 365 of file test_invalid_odl.c.
368 const char*
odl =
"%define { object Test; } %populate { object NoneExisting; }";
◆ test_select_none_existing_param()
void test_select_none_existing_param |
( |
UNUSED void ** |
state | ) |
|
Definition at line 380 of file test_invalid_odl.c.
383 const char*
odl =
"%define { object Test { string P1;} } %populate { object Test { parameter P2 = \"text\"; } }";