From: Daniel Zaoui Date: Wed, 21 May 2014 08:39:16 +0000 (+0300) Subject: Eolian/Tests: add test for consts X-Git-Tag: upstream/1.10.0+1149+ga3a15b1~815 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=946f845a2b92299846fa9b13610e588fde7339c7;p=platform%2Fupstream%2Fefl.git Eolian/Tests: add test for consts This tests checks the different 'const' possibilities in the .eo file and their good parsing. --- diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am index a945ea1..e4a189f 100644 --- a/src/Makefile_Eolian.am +++ b/src/Makefile_Eolian.am @@ -93,5 +93,6 @@ tests/eolian/data/typedef.eo \ tests/eolian/data/object_impl.eo \ tests/eolian/data/object_impl_ref.c \ tests/eolian/data/object_impl_add.eo \ -tests/eolian/data/object_impl_add_ref.c +tests/eolian/data/object_impl_add_ref.c \ +tests/eolian/data/consts.eo diff --git a/src/tests/eolian/data/consts.eo b/src/tests/eolian/data/consts.eo new file mode 100644 index 0000000..b139317 --- /dev/null +++ b/src/tests/eolian/data/consts.eo @@ -0,0 +1,28 @@ +class Const { + properties { + a { + set { + return Eina_Bool (EINA_TRUE); /*@ comment for property set return */ + } + get { + buffer: const; + } + values { + int value; /*@ Value description */ + char *buffer; + } + } + } + methods { + foo { + /*@ comment foo */ + params { + @in int a; /*@ a */ + @inout char *b; + @out double c; + } + const; + return char *(NULL); /*@ comment for method return */ + } + } +}; diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 2f9afc9..3589c88 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -9,6 +9,33 @@ #include "Eolian.h" #include "eolian_suite.h" +START_TEST(eolian_consts) +{ + Eolian_Function fid = NULL; + const char *class_name = "Const"; + Eolian_Function_Parameter param = NULL; + + eolian_init(); + /* Parsing */ + fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/consts.eo")); + + /* Class */ + fail_if(!eolian_class_exists(class_name)); + + /* Property */ + fail_if(!(fid = eolian_class_function_find_by_name(class_name, "a", EOLIAN_PROPERTY))); + fail_if(!(param = eolian_function_parameter_get(fid, "buffer"))); + fail_if(eolian_parameter_const_attribute_get(param, EINA_FALSE)); + fail_if(!eolian_parameter_const_attribute_get(param, EINA_TRUE)); + + /* Method */ + fail_if(!(fid = eolian_class_function_find_by_name(class_name, "foo", EOLIAN_METHOD))); + fail_if(EINA_FALSE == eolian_function_object_is_const(fid)); + + eolian_shutdown(); +} +END_TEST + START_TEST(eolian_ctor_dtor) { const char *class_name = "Ctor_Dtor"; @@ -277,5 +304,6 @@ void eolian_parsing_test(TCase *tc) tcase_add_test(tc, eolian_scope); tcase_add_test(tc, eolian_complex_type); tcase_add_test(tc, eolian_typedef); + tcase_add_test(tc, eolian_consts); }