tasn pushed a commit to branch master.
commit a26ed054a963572a01a8d4b73aae78f99f78bf8e
Author: Tom Hacohen <[email protected]>
Date: Wed Apr 24 16:45:34 2013 +0100
Eo: Added test to the special eina value type.
---
src/Makefile_Eo.am | 1 +
src/tests/eo/suite/eo_suite.c | 1 +
src/tests/eo/suite/eo_suite.h | 2 +-
src/tests/eo/suite/eo_test_class_simple.c | 10 ++++++
src/tests/eo/suite/eo_test_value.c | 54 +++++++++++++++++++++++++++++++
5 files changed, 67 insertions(+), 1 deletion(-)
diff --git a/src/Makefile_Eo.am b/src/Makefile_Eo.am
index 1e200f3..e955632 100644
--- a/src/Makefile_Eo.am
+++ b/src/Makefile_Eo.am
@@ -84,6 +84,7 @@ tests/eo/suite/eo_suite.c \
tests/eo/suite/eo_suite.h \
tests/eo/suite/eo_test_class_errors.c \
tests/eo/suite/eo_test_general.c \
+tests/eo/suite/eo_test_value.c \
tests/eo/suite/eo_test_init.c
tests_eo_eo_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
-DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eo\" \
diff --git a/src/tests/eo/suite/eo_suite.c b/src/tests/eo/suite/eo_suite.c
index 5194b32..9d040d3 100644
--- a/src/tests/eo/suite/eo_suite.c
+++ b/src/tests/eo/suite/eo_suite.c
@@ -20,6 +20,7 @@ static const Eo_Test_Case etc[] = {
{ "Eo init", eo_test_init },
{ "Eo general", eo_test_general },
{ "Eo class errors", eo_test_class_errors },
+ { "Eo eina value", eo_test_value },
{ NULL, NULL }
};
diff --git a/src/tests/eo/suite/eo_suite.h b/src/tests/eo/suite/eo_suite.h
index 9d79f42..c26db96 100644
--- a/src/tests/eo/suite/eo_suite.h
+++ b/src/tests/eo/suite/eo_suite.h
@@ -6,6 +6,6 @@
void eo_test_init(TCase *tc);
void eo_test_general(TCase *tc);
void eo_test_class_errors(TCase *tc);
-
+void eo_test_value(TCase *tc);
#endif /* _EO_SUITE_H */
diff --git a/src/tests/eo/suite/eo_test_class_simple.c
b/src/tests/eo/suite/eo_test_class_simple.c
index e21c54f..f691bda 100644
--- a/src/tests/eo/suite/eo_test_class_simple.c
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -40,9 +40,19 @@ _class_hi_print(const Eo_Class *klass, va_list *list)
}
static void
+_dbg_info_get(Eo *eo_obj, void *_pd EINA_UNUSED, va_list *list)
+{
+ Eo_Dbg_Info *root = (Eo_Dbg_Info *) va_arg(*list, Eo_Dbg_Info *);
+ eo_do_super(eo_obj, MY_CLASS, eo_dbg_info_get(root));
+ Eo_Dbg_Info *group = EO_DBG_INFO_LIST_APPEND(root, "Test list");
+ EO_DBG_INFO_APPEND(group, "Test", EINA_VALUE_TYPE_INT, 8);
+}
+
+static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
+ EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_DBG_INFO_GET), _dbg_info_get),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_SET), _a_set),
EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_PRINT), _a_print),
EO_OP_FUNC_CLASS(SIMPLE_ID(SIMPLE_SUB_ID_CLASS_HI_PRINT),
_class_hi_print),
diff --git a/src/tests/eo/suite/eo_test_value.c
b/src/tests/eo/suite/eo_test_value.c
new file mode 100644
index 0000000..71f2a00
--- /dev/null
+++ b/src/tests/eo/suite/eo_test_value.c
@@ -0,0 +1,54 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include "Eo.h"
+#include "eo_suite.h"
+#include "eo_test_class_simple.h"
+
+START_TEST(eo_value)
+{
+ eo_init();
+ char *str, *str2;
+ Eina_Value_List eo_list;
+
+ Eina_Value val2, eo_val;
+ void *tmpp = NULL;
+ Eo_Dbg_Info *eo_dbg_info, *tmp_dbg_info;
+ Eo *obj = eo_add(SIMPLE_CLASS, NULL);
+
+ eo_dbg_info = EO_DBG_INFO_LIST_APPEND(NULL, "Root");
+ fail_if(!eo_do(obj, eo_dbg_info_get(eo_dbg_info)));
+ fail_if(!eo_dbg_info);
+ ck_assert_str_eq(eo_dbg_info->name, "Root");
+ str = eina_value_to_string(&eo_dbg_info->value);
+ ck_assert_str_eq(str, "[[8]]");
+
+ eina_value_copy(&eo_dbg_info->value, &val2);
+ str2 = eina_value_to_string(&val2);
+ ck_assert_str_eq(str, str2);
+
+ eina_value_get(&val2, &eo_val);
+ eina_value_pget(&eo_val, &tmpp);
+ fail_if(!tmpp);
+ eina_value_free(&val2);
+
+ eina_value_setup(&val2, EINA_VALUE_TYPE_INT);
+ fail_if(eina_value_convert(&eo_dbg_info->value, &val2));
+ eina_value_free(&val2);
+
+ free(str);
+ free(str2);
+ eo_dbg_info_free(eo_dbg_info);
+ eo_unref(obj);
+
+ eo_shutdown();
+}
+END_TEST
+
+void eo_test_value(TCase *tc)
+{
+ tcase_add_test(tc, eo_value);
+}
--
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr